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

Method getBucketCors

api-bucket-cors.go:124–151  ·  view source on GitHub ↗
(ctx context.Context, bucketName string)

Source from the content-addressed store, hash-verified

122}
123
124func (c *Client) getBucketCors(ctx context.Context, bucketName string) (*cors.Config, error) {
125 urlValues := make(url.Values)
126 urlValues.Set("cors", "")
127
128 resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{
129 bucketName: bucketName,
130 queryValues: urlValues,
131 contentSHA256Hex: emptySHA256Hex, // TODO: needed? copied over from other example, but not spec'd in API.
132 })
133
134 defer closeResponse(resp)
135 if err != nil {
136 return nil, err
137 }
138
139 if resp != nil {
140 if resp.StatusCode != http.StatusOK {
141 return nil, httpRespToErrorResponse(resp, bucketName, "")
142 }
143 }
144
145 corsConfig, err := cors.ParseBucketCorsConfig(resp.Body)
146 if err != nil {
147 return nil, err
148 }
149
150 return corsConfig, nil
151}

Callers 1

GetBucketCorsMethod · 0.95

Calls 5

executeMethodMethod · 0.95
ParseBucketCorsConfigFunction · 0.92
httpRespToErrorResponseFunction · 0.85
closeResponseFunction · 0.70
SetMethod · 0.45

Tested by

no test coverage detected