From 44546a40372260158652ddc6d805ddfc19f13fa3 Mon Sep 17 00:00:00 2001 From: jojoliang Date: Wed, 4 Dec 2019 10:52:49 +0800 Subject: [PATCH] optional header for complete upload part --- object_part.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/object_part.go b/object_part.go index a96e937..897afca 100644 --- a/object_part.go +++ b/object_part.go @@ -114,8 +114,9 @@ func (s *ObjectService) ListParts(ctx context.Context, name, uploadID string, op // CompleteMultipartUploadOptions is the option of CompleteMultipartUpload type CompleteMultipartUploadOptions struct { - XMLName xml.Name `xml:"CompleteMultipartUpload"` - Parts []Object `xml:"Part"` + XMLName xml.Name `xml:"CompleteMultipartUpload" header:"-" url:"-"` + Parts []Object `xml:"Part" header:"-" url:"-"` + XOptionHeader *http.Header `header:"-,omitempty" xml:"-" url:"-"` } // CompleteMultipartUploadResult is the result CompleteMultipartUpload @@ -161,11 +162,12 @@ func (s *ObjectService) CompleteMultipartUpload(ctx context.Context, name, uploa u := fmt.Sprintf("/%s?uploadId=%s", encodeURIComponent(name), uploadID) var res CompleteMultipartUploadResult sendOpt := sendOptions{ - baseURL: s.client.BaseURL.BucketURL, - uri: u, - method: http.MethodPost, - body: opt, - result: &res, + baseURL: s.client.BaseURL.BucketURL, + uri: u, + method: http.MethodPost, + optHeader: opt, + body: opt, + result: &res, } resp, err := s.client.send(ctx, &sendOpt) // If the error occurs during the copy operation, the error response is embedded in the 200 OK response. This means that a 200 OK response can contain either a success or an error.