@@ -6,7 +6,7 @@ const crypto = require('crypto')
6
6
const cos = require ( '../lib/cos/cos' )
7
7
const _ = require ( 'lodash' )
8
8
9
- var defaults = {
9
+ const DEFAULTS = {
10
10
signatureMethod : 'HmacSHA1' ,
11
11
method : 'GET' ,
12
12
Region : 'ap-guangzhou' ,
@@ -23,7 +23,7 @@ class TencentCloudClient {
23
23
async cloudApiGenerateQueryString ( data ) {
24
24
var param = assign (
25
25
{
26
- Region : this . options . region || defaults . Region ,
26
+ Region : this . options . region || DEFAULTS . Region ,
27
27
SecretId : this . credentials . SecretId ,
28
28
Timestamp : Math . round ( Date . now ( ) / 1000 ) ,
29
29
Nonce : Math . round ( Math . random ( ) * 65535 ) ,
@@ -38,7 +38,7 @@ class TencentCloudClient {
38
38
if ( this . credentials . token ) {
39
39
param . token = this . credentials . token
40
40
}
41
- param . SignatureMethod = defaults . signatureMethod
41
+ param . SignatureMethod = DEFAULTS . signatureMethod
42
42
param = dotQs . flatten ( param )
43
43
const { host, path } = this . service
44
44
var keys = Object . keys ( param )
@@ -59,7 +59,7 @@ class TencentCloudClient {
59
59
60
60
const hmac = crypto . createHmac ( 'sha1' , this . credentials . SecretKey || '' )
61
61
param . Signature = hmac
62
- . update ( new Buffer . from ( defaults . method . toUpperCase ( ) + host + path + '?' + qstr , 'utf8' ) )
62
+ . update ( new Buffer . from ( DEFAULTS . method . toUpperCase ( ) + host + path + '?' + qstr , 'utf8' ) )
63
63
. digest ( 'base64' )
64
64
65
65
return qs . stringify ( param )
0 commit comments