@alicloud/mns
Advanced tools
Comparing version 1.0.0-beta4 to 1.0.0-beta5
@@ -108,5 +108,5 @@ 'use strict'; | ||
const canonicalizedMNSHeaders = getCanonicalizedMNSHeaders(headers); | ||
const md5 = headers['content-md5']; | ||
const md5 = headers['content-md5'] || ''; | ||
const date = headers['date']; | ||
const type = headers['content-type']; | ||
const type = headers['content-type'] || ''; | ||
@@ -127,10 +127,4 @@ var toSignString = `${verb}\n${md5}\n${type}\n${date}\n${canonicalizedMNSHeaders}${resource}`; | ||
const date = new Date().toGMTString(); | ||
const contentType = 'text/xml'; | ||
const digest = kitx.md5(body, 'hex'); | ||
const md5 = Buffer.from(digest, 'utf8').toString('base64'); | ||
const headers = Object.assign({ | ||
'content-length': body.length, | ||
'content-type': contentType, | ||
'content-md5': md5, | ||
const headers = { | ||
'date': date, | ||
@@ -140,4 +134,17 @@ 'host': this.endpointDomain, | ||
'x-mns-version': '2015-06-06' | ||
}, customHeaders); | ||
}; | ||
if (method !== 'GET' && method !== 'HEAD') { | ||
const contentType = 'text/xml'; | ||
const digest = kitx.md5(body, 'hex'); | ||
const md5 = Buffer.from(digest, 'utf8').toString('base64'); | ||
Object.assign(headers, { | ||
'content-length': body.length, | ||
'content-type': contentType, | ||
'content-md5': md5 | ||
}); | ||
} | ||
Object.assign(headers, customHeaders); | ||
const signature = this.sign(method, headers, resource); | ||
@@ -157,3 +164,4 @@ | ||
const body = toXMLBuffer('Queue', params); | ||
return this.put(`/queues/${name}`, 'Queue', body, ['location']); | ||
const url = `/queues/${name}`; | ||
return this.put(url, 'Queue', body, ['location']); | ||
} | ||
@@ -193,3 +201,4 @@ | ||
const body = toXMLBuffer('Queue', params); | ||
return this.put(`/queues/${queueName}?metaoverride=true`, 'Queue', body); | ||
const url = `/queues/${queueName}?metaoverride=true`; | ||
return this.put(url, 'Queue', body); | ||
} | ||
@@ -241,3 +250,4 @@ | ||
async batchPeekMessage(queueName, numOfMessages) { | ||
const url = `/queues/${queueName}/messages?peekonly=true&numOfMessages=${numOfMessages}`; | ||
const url = `/queues/${queueName}/messages?` + | ||
`peekonly=true&numOfMessages=${numOfMessages}`; | ||
@@ -258,3 +268,4 @@ const subType = 'Message'; | ||
const body = toXMLBuffer('ReceiptHandles', receiptHandles); | ||
const response = await this.delete(`/queues/${queueName}/messages`, 'Errors', body, ); | ||
const url = `/queues/${queueName}/messages`; | ||
const response = await this.delete(url, 'Errors', body); | ||
const subType = 'Error'; | ||
@@ -266,3 +277,5 @@ response.body = response.body[subType]; | ||
changeMessageVisibility(queueName, receiptHandle, visibilityTimeout) { | ||
return this.put(`/queues/${queueName}/messages?receiptHandle=${receiptHandle}&visibilityTimeout=${visibilityTimeout}`, 'ChangeVisibility'); | ||
const url = `/queues/${queueName}/messages?` + | ||
`receiptHandle=${receiptHandle}&visibilityTimeout=${visibilityTimeout}`; | ||
return this.put(url, 'ChangeVisibility'); | ||
} | ||
@@ -305,3 +318,4 @@ | ||
const body = toXMLBuffer('Topic', params); | ||
return this.put(`/topics/${name}?metaoverride=true`, 'Topic', body); | ||
const url = `/topics/${name}?metaoverride=true`; | ||
return this.put(url, 'Topic', body); | ||
} | ||
@@ -308,0 +322,0 @@ |
{ | ||
"name": "@alicloud/mns", | ||
"version": "1.0.0-beta4", | ||
"version": "1.0.0-beta5", | ||
"description": "> 该 SDK 并未完全实现所有文档所提及的功能,如果您想使用的功能并未实现,请提[issue](https://github.com/aliyun/aliyun-mns-nodejs-sdk/issues/new)以增加优先级。", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16829
358