From 95193473e7d61b1a6cb99bda124189909087ac05 Mon Sep 17 00:00:00 2001 From: chrisftian Date: Thu, 11 Nov 2021 11:58:22 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=94=AF=E6=8C=81mimeLimit?= =?UTF-8?q?=EF=BC=9BtrafficLimit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- sdk/advance.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d2c3526..fcf20c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cos-nodejs-sdk-v5", - "version": "2.10.8", + "version": "2.10.9", "description": "cos nodejs sdk v5", "main": "index.js", "types": "index.d.ts", diff --git a/sdk/advance.js b/sdk/advance.js index 8ad6c35..1900bee 100644 --- a/sdk/advance.js +++ b/sdk/advance.js @@ -589,6 +589,14 @@ function uploadSliceItem(params, callback) { ContentLength = end - start; } + var headersWhiteList = ['x-cos-traffic-limit', 'x-cos-mime-limit']; + var headers = {}; + util.each(Headers, function(v, k) { + if (headersWhiteList.indexOf(k) > -1) { + headers[k] = v; + } + }); + util.fileSlice(FilePath, start, end, function (md5Body) { util.getFileMd5(md5Body, function (err, md5) { var contentMd5 = md5 ? util.binaryBase64(md5) : ''; @@ -606,6 +614,7 @@ function uploadSliceItem(params, callback) { UploadId: UploadData.UploadId, ServerSideEncryption: ServerSideEncryption, Body: Body, + Headers: headers, onProgress: params.onProgress, ContentMD5: contentMd5, }, function (err, data) {