Skip to content

Commit

Permalink
优化参数污染问题
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Mar 14, 2018
1 parent 3e8bced commit ee1626e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ var apiWrapper = function (apiName, apiFn) {
params = {};
}

// 复制参数对象
params = extend({}, params);

// 统一处理 Headers
var Headers = params.Headers || {};
if (params && typeof params === 'object') {
Expand Down Expand Up @@ -348,7 +351,7 @@ var apiWrapper = function (apiName, apiFn) {
Headers['x-cos-grant-read-acp'] = params['GrantReadAcp'];
Headers['x-cos-grant-write-acp'] = params['GrantWriteAcp'];
Headers['x-cos-storage-class'] = params['StorageClass'];
params.Headers = Headers;
params.Headers = clearKey(Headers);
}

// 代理回调函数
Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ var apiWrapper = function (apiName, apiFn) {
params = {};
}

// 复制参数对象
params = extend({}, params);

// 统一处理 Headers
var Headers = params.Headers || {};
if (params && typeof params === 'object') {
Expand Down Expand Up @@ -278,7 +281,7 @@ var apiWrapper = function (apiName, apiFn) {
Headers['x-cos-grant-read-acp'] = params['GrantReadAcp'];
Headers['x-cos-grant-write-acp'] = params['GrantWriteAcp'];
Headers['x-cos-storage-class'] = params['StorageClass'];
params.Headers = Headers;
params.Headers = clearKey(Headers);
}

// 代理回调函数
Expand Down

0 comments on commit ee1626e

Please sign in to comment.