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

Method GetBucketCors

api-bucket-cors.go:109–122  ·  view source on GitHub ↗

GetBucketCors retrieves the Cross-Origin Resource Sharing (CORS) configuration from the bucket. If no CORS configuration exists, returns nil with no error. Parameters: - ctx: Context for request cancellation and timeout - bucketName: Name of the bucket Returns the CORS configuration or an error if

(ctx context.Context, bucketName string)

Source from the content-addressed store, hash-verified

107//
108// Returns the CORS configuration or an error if the operation fails.
109func (c *Client) GetBucketCors(ctx context.Context, bucketName string) (*cors.Config, error) {
110 if err := s3utils.CheckValidBucketName(bucketName); err != nil {
111 return nil, err
112 }
113 bucketCors, err := c.getBucketCors(ctx, bucketName)
114 if err != nil {
115 errResponse := ToErrorResponse(err)
116 if errResponse.Code == NoSuchCORSConfiguration {
117 return nil, nil
118 }
119 return nil, err
120 }
121 return bucketCors, nil
122}
123
124func (c *Client) getBucketCors(ctx context.Context, bucketName string) (*cors.Config, error) {
125 urlValues := make(url.Values)

Callers 2

testCorsSetGetDeleteFunction · 0.95
mainFunction · 0.80

Calls 3

getBucketCorsMethod · 0.95
CheckValidBucketNameFunction · 0.92
ToErrorResponseFunction · 0.85

Tested by

no test coverage detected