From 2eee5149d727a045e80d28729bb60c90614e8275 Mon Sep 17 00:00:00 2001 From: keroming Date: Thu, 7 May 2020 17:46:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=B9=E4=B8=BA=E5=8F=AF=E9=80=89?= =?UTF-8?q?=E5=8F=82=E6=95=B0=EF=BC=8C=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- object.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/object.go b/object.go index dd9c358..255c0d1 100644 --- a/object.go +++ b/object.go @@ -283,17 +283,21 @@ type ObjectDeleteOptions struct { // Delete Object请求可以将一个文件(Object)删除。 // // https://www.qcloud.com/document/product/436/7743 -func (s *ObjectService) Delete(ctx context.Context, name string, opt *ObjectDeleteOptions) (*Response, error) { +func (s *ObjectService) Delete(ctx context.Context, name string, opt ...*ObjectDeleteOptions) (*Response, error) { + var optHeader *ObjectDeleteOptions // When use "" string might call the delete bucket interface if len(name) == 0 { return nil, errors.New("empty object name") } + if len(opt) > 0 { + optHeader = opt[0] + } sendOpt := sendOptions{ baseURL: s.client.BaseURL.BucketURL, uri: "/" + encodeURIComponent(name), method: http.MethodDelete, - optHeader: opt, + optHeader: optHeader, } resp, err := s.client.send(ctx, &sendOpt) return resp, err