MCPcopy
hub / github.com/minio/minio-go / xmlDecodeAndBody

Function xmlDecodeAndBody

pkg/credentials/error_response.go:87–95  ·  view source on GitHub ↗

xmlDecodeAndBody reads the whole body up to 1MB and tries to XML decode it into v. The body that was read and any error from reading or decoding is returned.

(bodyReader io.Reader, v interface{})

Source from the content-addressed store, hash-verified

85// tries to XML decode it into v.
86// The body that was read and any error from reading or decoding is returned.
87func xmlDecodeAndBody(bodyReader io.Reader, v interface{}) ([]byte, error) {
88 // read the whole body (up to 1MB)
89 const maxBodyLength = 1 << 20
90 body, err := io.ReadAll(io.LimitReader(bodyReader, maxBodyLength))
91 if err != nil {
92 return nil, err
93 }
94 return bytes.TrimSpace(body), xmlDecoder(bytes.NewReader(body), v)
95}

Callers 5

getAssumeRoleCredentialsFunction · 0.70

Calls 1

xmlDecoderFunction · 0.70

Tested by

no test coverage detected