@alicloud/pop-core
Advanced tools
Comparing version 1.2.4 to 1.3.0
@@ -30,2 +30,8 @@ 'use strict'; | ||
this.host = url.parse(this.endpoint).hostname; | ||
var httpModule = this.host.startsWith('https://') ? require('https') : require('http'); | ||
this.keepAliveAgent = new httpModule.Agent({ | ||
keepAlive: true, | ||
keepAliveMsecs: 3000 | ||
}); | ||
} | ||
@@ -110,3 +116,3 @@ | ||
request(method, uriPattern, query = {}, body = '', headers = {}) { | ||
request(method, uriPattern, query = {}, body = '', headers = {}, opts) { | ||
var postBody = null; | ||
@@ -130,7 +136,10 @@ | ||
return httpx.request(url, { | ||
const options = Object.assign({ | ||
method, | ||
agent: this.keepAliveAgent, | ||
headers: mixHeaders, | ||
data: postBody | ||
}).then((response) => { | ||
}, opts); | ||
return httpx.request(url, options).then((response) => { | ||
return httpx.read(response, 'utf8').then((body) => { | ||
@@ -137,0 +146,0 @@ const contentType = response.headers['content-type'] || ''; |
{ | ||
"name": "@alicloud/pop-core", | ||
"version": "1.2.4", | ||
"version": "1.3.0", | ||
"description": "AliCloud POP SDK core", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -49,3 +49,4 @@ # @alicloud/pop-core | ||
// => returns Promise | ||
// request(HTTPMethod, uriPath, queries, body, headers); | ||
// request(HTTPMethod, uriPath, queries, body, headers, options); | ||
// options => {timeout} | ||
client.request('GET', '/regions'); | ||
@@ -52,0 +53,0 @@ // co/yield, async/await |
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
13336
320
57
6