Skip to content

Commit 965d6d4

Browse files
committed
fix: make default to DEFAULTS
1 parent f236089 commit 965d6d4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/client.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const crypto = require('crypto')
66
const cos = require('../lib/cos/cos')
77
const _ = require('lodash')
88

9-
var defaults = {
9+
const DEFAULTS = {
1010
signatureMethod: 'HmacSHA1',
1111
method: 'GET',
1212
Region: 'ap-guangzhou',
@@ -23,7 +23,7 @@ class TencentCloudClient {
2323
async cloudApiGenerateQueryString(data) {
2424
var param = assign(
2525
{
26-
Region: this.options.region || defaults.Region,
26+
Region: this.options.region || DEFAULTS.Region,
2727
SecretId: this.credentials.SecretId,
2828
Timestamp: Math.round(Date.now() / 1000),
2929
Nonce: Math.round(Math.random() * 65535),
@@ -38,7 +38,7 @@ class TencentCloudClient {
3838
if (this.credentials.token) {
3939
param.token = this.credentials.token
4040
}
41-
param.SignatureMethod = defaults.signatureMethod
41+
param.SignatureMethod = DEFAULTS.signatureMethod
4242
param = dotQs.flatten(param)
4343
const { host, path } = this.service
4444
var keys = Object.keys(param)
@@ -59,7 +59,7 @@ class TencentCloudClient {
5959

6060
const hmac = crypto.createHmac('sha1', this.credentials.SecretKey || '')
6161
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'))
6363
.digest('base64')
6464

6565
return qs.stringify(param)

0 commit comments

Comments
 (0)