Skip to content

Commit

Permalink
fix headobject (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
lewzylu committed May 15, 2018
1 parent a05720b commit f813fab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions object.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ func (s *ObjectService) Head(ctx context.Context, name string, opt *ObjectHeadOp
optHeader: opt,
}
resp, err := s.client.send(ctx, &sendOpt)
if resp.Header["X-Cos-Object-Type"][0] == "appendable" {
resp.Header.Add("x-cos-next-append-position",resp.Header["Content-Length"][0])
}

return resp, err
}

Expand Down Expand Up @@ -212,6 +216,9 @@ func (s *ObjectService) Options(ctx context.Context, name string, opt *ObjectOpt
// https://www.qcloud.com/document/product/436/7741
func (s *ObjectService) Append(ctx context.Context, name string, position int, r io.Reader, opt *ObjectPutOptions) (*Response, error) {
u := fmt.Sprintf("/%s?append&position=%d", encodeURIComponent(name), position)
if position != 0{
opt = nil
}
sendOpt := sendOptions{
baseURL: s.client.BaseURL.BucketURL,
uri: u,
Expand Down

0 comments on commit f813fab

Please sign in to comment.