Skip to content

Commit

Permalink
Merge pull request #137 from livehigh/v1.3.5
Browse files Browse the repository at this point in the history
feat:cos.request支持透传DataType
  • Loading branch information
carsonxu authored Feb 11, 2022
2 parents 28adb2e + 691c778 commit 6db58c1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,8 @@ function getSnapshot() {
// mode: 'exactframe', /** 截帧方式,默认为'exactframe',非必须 */
},
RawBody: true,
// 可选返回文件格式为blob
DataType: 'blob',
},
function(err, data){
logger.log(err || data);
Expand Down
5 changes: 3 additions & 2 deletions dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -2485,7 +2485,7 @@ COS.util = {
json2xml: util.json2xml
};
COS.getAuthorization = util.getAuth;
COS.version = '1.3.4';
COS.version = '1.3.5';

module.exports = COS;

Expand Down Expand Up @@ -7764,7 +7764,8 @@ function request(params, callback) {
qs: params.Query,
body: params.Body,
Url: params.Url,
rawBody: params.RawBody
rawBody: params.RawBody,
DataType: params.DataType
}, function (err, data) {
if (err) return callback(err);
if (data && data.body) {
Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,8 @@ Bulk:批量模式,恢复时间为24 - 48小时。 */
Url?: string,
/** 返回值body是否不需要解析 */
RawBody?: boolean,
/** 返回文件内容格式,如string、blob、arraybuffer */
DataType?: string,
}
/** Request 接口返回值 */
interface RequestResult extends GeneralResult {
Expand Down
1 change: 1 addition & 0 deletions src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2890,6 +2890,7 @@ function request(params, callback) {
body: params.Body,
Url: params.Url,
rawBody: params.RawBody,
DataType: params.DataType,
}, function (err, data) {
if (err) return callback(err);
if (data && data.body) {
Expand Down
2 changes: 1 addition & 1 deletion src/cos.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ COS.util = {
json2xml: util.json2xml,
};
COS.getAuthorization = util.getAuth;
COS.version = '1.3.4';
COS.version = '1.3.5';

module.exports = COS;

0 comments on commit 6db58c1

Please sign in to comment.