(ctx context.Context, bucketName string)
| 122 | } |
| 123 | |
| 124 | func (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 | } |
no test coverage detected