File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,24 @@ type BucketGetPolicyResult BucketPutPolicyOptions
2727
2828func (s * BucketService ) PutPolicy (ctx context.Context , opt * BucketPutPolicyOptions ) (* Response , error ) {
2929 var f * strings.Reader
30+ var body string
3031 if opt != nil {
3132 bs , err := json .Marshal (opt )
3233 if err != nil {
3334 return nil , err
3435 }
35- body : = string (bs )
36+ body = string (bs )
3637 f = strings .NewReader (body )
3738 }
39+ header := & commonHeader {
40+ ContentLength : int64 (len (body )),
41+ }
3842 sendOpt := & sendOptions {
39- baseURL : s .client .BaseURL .BucketURL ,
40- uri : "/?policy" ,
41- method : http .MethodPut ,
42- body : f ,
43+ baseURL : s .client .BaseURL .BucketURL ,
44+ uri : "/?policy" ,
45+ method : http .MethodPut ,
46+ body : f ,
47+ optHeader : header ,
4348 }
4449 resp , err := s .client .send (ctx , sendOpt )
4550 return resp , err
Original file line number Diff line number Diff line change @@ -267,6 +267,10 @@ func (c *Client) GetCredential() *Credential {
267267 return nil
268268}
269269
270+ type commonHeader struct {
271+ ContentLength int64 `header:"Content-Length,omitempty"`
272+ }
273+
270274func (c * Client ) newPresignedRequest (ctx context.Context , sendOpt * sendOptions ) (req * http.Request , err error ) {
271275 sendOpt .uri , err = addURLOptions (sendOpt .uri , sendOpt .optQuery )
272276 if err != nil {
You can’t perform that action at this time.
0 commit comments