Skip to content

Commit

Permalink
fix createbucket bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dengwu12 committed Apr 25, 2017
1 parent 82da2e8 commit ef36e0f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions oss/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ func (client Client) CreateBucket(bucketName string, options ...Option) error {
headers := make(map[string]string)
handleOptions(headers, options)

var resp *Response
var err error
buffer := new(bytes.Buffer)

isOptSet, val, _ := isOptionSet(options, storageClass)
if isOptSet {
Expand All @@ -107,17 +106,13 @@ func (client Client) CreateBucket(bucketName string, options ...Option) error {
if err != nil {
return err
}
buffer := new(bytes.Buffer)
buffer.Write(bs)

contentType := http.DetectContentType(buffer.Bytes())
headers[HTTPHeaderContentType] = contentType

resp, err = client.do("PUT", bucketName, "", "", headers, buffer)
} else {
resp, err = client.do("PUT", bucketName, "", "", headers, nil)
}

resp, err := client.do("PUT", bucketName, "", "", headers, buffer)
if err != nil {
return err
}
Expand Down

0 comments on commit ef36e0f

Please sign in to comment.