Skip to content

Commit 2eee514

Browse files
author
keroming
committed
feat: 改为可选参数,向下兼容
1 parent 279cb4f commit 2eee514

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

object.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,21 @@ type ObjectDeleteOptions struct {
283283
// Delete Object请求可以将一个文件(Object)删除。
284284
//
285285
// https://www.qcloud.com/document/product/436/7743
286-
func (s *ObjectService) Delete(ctx context.Context, name string, opt *ObjectDeleteOptions) (*Response, error) {
286+
func (s *ObjectService) Delete(ctx context.Context, name string, opt ...*ObjectDeleteOptions) (*Response, error) {
287+
var optHeader *ObjectDeleteOptions
287288
// When use "" string might call the delete bucket interface
288289
if len(name) == 0 {
289290
return nil, errors.New("empty object name")
290291
}
292+
if len(opt) > 0 {
293+
optHeader = opt[0]
294+
}
291295

292296
sendOpt := sendOptions{
293297
baseURL: s.client.BaseURL.BucketURL,
294298
uri: "/" + encodeURIComponent(name),
295299
method: http.MethodDelete,
296-
optHeader: opt,
300+
optHeader: optHeader,
297301
}
298302
resp, err := s.client.send(ctx, &sendOpt)
299303
return resp, err

0 commit comments

Comments
 (0)