Skip to content

Commit 7f11784

Browse files
authored
feat: pic-operations加入签名计算 (#195)
1 parent 735ab44 commit 7f11784

File tree

3 files changed

+35
-30
lines changed

3 files changed

+35
-30
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cos-nodejs-sdk-v5",
3-
"version": "2.12.5",
3+
"version": "2.12.6",
44
"description": "cos nodejs sdk v5",
55
"main": "index.js",
66
"types": "index.d.ts",

sdk/util.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ var signHeaders = [
6969
'origin',
7070
'range',
7171
'transfer-encoding',
72+
'pic-operations',
7273
];
7374

7475
var getSignHeaderObj = function (headers) {

test/test.js

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ group('getService()', function () {
348348
}
349349
);
350350
})
351-
.catch(function () { });
351+
.catch(function () {});
352352
});
353353
test('getService 不传Region和Domain', function (done, assert) {
354354
var cos = new COS({
@@ -369,7 +369,7 @@ group('getService()', function () {
369369
done();
370370
});
371371
})
372-
.catch(function () { });
372+
.catch(function () {});
373373
});
374374
test('能正常列出 Bucket', function (done, assert) {
375375
prepareBucket()
@@ -391,7 +391,7 @@ group('getService()', function () {
391391
}
392392
);
393393
})
394-
.catch(function () { });
394+
.catch(function () {});
395395
});
396396
});
397397

@@ -773,7 +773,7 @@ group('putObject(),cancelTask()', function () {
773773
done();
774774
}
775775
);
776-
cos.on('task-list-update', function () { });
776+
cos.on('task-list-update', function () {});
777777
});
778778
});
779779

@@ -792,7 +792,7 @@ group('task 队列', function () {
792792
taskId = id;
793793
},
794794
},
795-
function (err, data) { }
795+
function (err, data) {}
796796
);
797797
};
798798
for (var i = 0; i < 1200; i++) {
@@ -881,8 +881,8 @@ group('sliceUploadFile() 完整上传文件', function () {
881881
FilePath: filePath,
882882
onTaskReady: function (taskId) {
883883
TaskId = taskId;
884-
cos.on('list-update', info => {
885-
const fileTask = info.list.find(item => item.id === taskId);
884+
cos.on('list-update', (info) => {
885+
const fileTask = info.list.find((item) => item.id === taskId);
886886
if (fileTask && paused && restarted) {
887887
if (fileTask.percent === 0) return;
888888
assert.ok(fileTask.percent > 0.3, '暂停和重试成功');
@@ -953,7 +953,7 @@ group('sliceUploadFile() 完整上传文件', function () {
953953
}
954954
},
955955
},
956-
function (err, data) { }
956+
function (err, data) {}
957957
);
958958
}
959959
);
@@ -1249,7 +1249,7 @@ group('putObject()', function () {
12491249
Bucket: config.Bucket,
12501250
Region: config.Region,
12511251
Key: filename,
1252-
onProgress: function (info) { },
1252+
onProgress: function (info) {},
12531253
Output: outputStream,
12541254
},
12551255
function (err, data) {
@@ -2985,18 +2985,18 @@ group('BucketPolicy', function () {
29852985
],
29862986
resource: [
29872987
'qcs::cos:' +
2988-
config.Region +
2989-
':uid/' +
2990-
AppId +
2991-
':' +
2992-
BucketLongName +
2993-
'//' +
2994-
AppId +
2995-
'/' +
2996-
BucketShortName +
2997-
'/' +
2998-
Prefix +
2999-
'/*',
2988+
config.Region +
2989+
':uid/' +
2990+
AppId +
2991+
':' +
2992+
BucketLongName +
2993+
'//' +
2994+
AppId +
2995+
'/' +
2996+
BucketShortName +
2997+
'/' +
2998+
Prefix +
2999+
'/*',
30003000
], // 1250000000 是 appid
30013001
},
30023002
],
@@ -3115,8 +3115,8 @@ group('BucketLocation', function () {
31153115
};
31163116
assert.ok(
31173117
data.LocationConstraint === config.Region ||
3118-
data.LocationConstraint === map1[config.Region] ||
3119-
data.LocationConstraint === map2[config.Region]
3118+
data.LocationConstraint === map1[config.Region] ||
3119+
data.LocationConstraint === map2[config.Region]
31203120
);
31213121
done();
31223122
}
@@ -3271,7 +3271,7 @@ group('BucketWebsite', function () {
32713271
Redirect: {
32723272
Protocol: 'https',
32733273
ReplaceKeyWith: '404.html',
3274-
URLRedirect: 'Enabled'
3274+
URLRedirect: 'Enabled',
32753275
},
32763276
},
32773277
{
@@ -3281,7 +3281,7 @@ group('BucketWebsite', function () {
32813281
Redirect: {
32823282
Protocol: 'https',
32833283
ReplaceKeyPrefixWith: 'documents/',
3284-
URLRedirect: 'Enabled'
3284+
URLRedirect: 'Enabled',
32853285
},
32863286
},
32873287
{
@@ -3291,7 +3291,7 @@ group('BucketWebsite', function () {
32913291
Redirect: {
32923292
Protocol: 'https',
32933293
ReplaceKeyWith: 'picture.jpg',
3294-
URLRedirect: 'Enabled'
3294+
URLRedirect: 'Enabled',
32953295
},
32963296
},
32973297
];
@@ -4057,7 +4057,7 @@ group('Cache-Control', function () {
40574057
console.log('data.headers 4057', data.headers);
40584058
assert.ok(
40594059
data.headers['cache-control'] === 'no-cache' ||
4060-
data.headers['cache-control'] === 'no-cache, max-age=259200',
4060+
data.headers['cache-control'] === 'no-cache, max-age=259200',
40614061
'cache-control 正确'
40624062
);
40634063
done();
@@ -4139,7 +4139,7 @@ group('Cache-Control', function () {
41394139
console.log('data.headers 4139', data.headers);
41404140
assert.ok(
41414141
data.headers['cache-control'] === 'no-cache' ||
4142-
data.headers['cache-control'] === 'no-cache, max-age=259200',
4142+
data.headers['cache-control'] === 'no-cache, max-age=259200',
41434143
'cache-control 正确'
41444144
);
41454145
fs.unlinkSync(filePath);
@@ -5237,7 +5237,11 @@ group('BucketReplication', function () {
52375237
Region: config.Region,
52385238
},
52395239
function (err, data) {
5240-
console.log('data.ReplicationConfiguration.Rules[0].ID', data.ReplicationConfiguration.Rules[0].ID, ruleId);
5240+
console.log(
5241+
'data.ReplicationConfiguration.Rules[0].ID',
5242+
data.ReplicationConfiguration.Rules[0].ID,
5243+
ruleId
5244+
);
52415245
assert.ok(data.ReplicationConfiguration.Rules[0].ID === ruleId);
52425246
done();
52435247
}

0 commit comments

Comments
 (0)