nodecommons-rest
Advanced tools
Comparing version 4.0.2 to 4.0.3
@@ -12,8 +12,8 @@ import { TEncodedObject } from 'tscommons-core'; | ||
constructor(contentType?: ECommonsHttpContentType); | ||
internalHead(script: string, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<void>; | ||
internalGet<T>(script: string, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<T>; | ||
internalDelete<T>(script: string, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<T>; | ||
internalPost<T, B extends TEncodedObject = TEncodedObject>(script: string, body: B, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<T>; | ||
internalPut<T, B extends TEncodedObject = TEncodedObject>(script: string, body: B, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<T>; | ||
internalPatch<T, B extends TEncodedObject = TEncodedObject>(script: string, body: B, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<T>; | ||
internalHead(url: string, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<void>; | ||
internalGet<T>(url: string, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<T>; | ||
internalDelete<T>(url: string, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<T>; | ||
internalPost<T, B extends TEncodedObject = TEncodedObject>(url: string, body: B, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<T>; | ||
internalPut<T, B extends TEncodedObject = TEncodedObject>(url: string, body: B, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<T>; | ||
internalPatch<T, B extends TEncodedObject = TEncodedObject>(url: string, body: B, params: THttpHeaderOrParamObject, headers: THttpHeaderOrParamObject, options: TCommonsHttpInternalRequestOptions): Promise<T>; | ||
} |
@@ -74,13 +74,13 @@ "use strict"; | ||
} | ||
static requestHeadGetDelete(method, script, params, headers, returnResult, returnRawResult, timeout) { | ||
const protocol = script.match(/^https:/) ? https : http; | ||
static requestHeadGetDelete(method, url, params, headers, returnResult, returnRawResult, timeout) { | ||
const protocol = url.match(/^https:/) ? https : http; | ||
if (params && Object.keys(params).length > 0) { | ||
script = nodecommons_url_1.CommonsUrl.appendEncodedObjectParams(script, params); | ||
url = nodecommons_url_1.CommonsUrl.appendEncodedObjectParams(url, params); | ||
} | ||
const url = new url_1.URL(script); | ||
const urlObject = new url_1.URL(url); | ||
const options = { | ||
protocol: url.protocol, | ||
hostname: url.hostname, | ||
port: parseInt(url.port, 10), | ||
path: url.search ? `${url.pathname}${url.search}` : url.pathname, | ||
protocol: urlObject.protocol, | ||
hostname: urlObject.hostname, | ||
port: parseInt(urlObject.port, 10), | ||
path: urlObject.search ? `${urlObject.pathname}${urlObject.search}` : urlObject.pathname, | ||
method: method, | ||
@@ -92,13 +92,13 @@ headers: headers, | ||
} | ||
static requestPostPutPatch(method, script, body, contentType, params, headers, returnResult, returnRawResult, timeout) { | ||
const protocol = script.match(/^https:/) ? https : http; | ||
static requestPostPutPatch(method, url, body, contentType, params, headers, returnResult, returnRawResult, timeout) { | ||
const protocol = url.match(/^https:/) ? https : http; | ||
if (params && Object.keys(params).length > 0) { | ||
script = nodecommons_url_1.CommonsUrl.appendEncodedObjectParams(script, params); | ||
url = nodecommons_url_1.CommonsUrl.appendEncodedObjectParams(url, params); | ||
} | ||
const url = new url_1.URL(script); | ||
const urlObject = new url_1.URL(url); | ||
const options = { | ||
protocol: url.protocol, | ||
hostname: url.hostname, | ||
port: parseInt(url.port, 10), | ||
path: url.search ? `${url.pathname}${url.search}` : url.pathname, | ||
protocol: urlObject.protocol, | ||
hostname: urlObject.hostname, | ||
port: parseInt(urlObject.port, 10), | ||
path: urlObject.search ? `${urlObject.pathname}${urlObject.search}` : urlObject.pathname, | ||
method: method, | ||
@@ -123,20 +123,20 @@ headers: headers, | ||
} | ||
internalHead(script, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestHeadGetDelete(tscommons_http_4.ECommonsHttpMethod.HEAD, script, params, headers, false, true, // na | ||
internalHead(url, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestHeadGetDelete(tscommons_http_4.ECommonsHttpMethod.HEAD, url, params, headers, false, true, // na | ||
options.timeout); | ||
} | ||
internalGet(script, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestHeadGetDelete(tscommons_http_4.ECommonsHttpMethod.GET, script, params, headers, true, options.returnRawResult || false, options.timeout); | ||
internalGet(url, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestHeadGetDelete(tscommons_http_4.ECommonsHttpMethod.GET, url, params, headers, true, options.returnRawResult || false, options.timeout); | ||
} | ||
internalDelete(script, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestHeadGetDelete(tscommons_http_4.ECommonsHttpMethod.DELETE, script, params, headers, true, options.returnRawResult || false, options.timeout); | ||
internalDelete(url, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestHeadGetDelete(tscommons_http_4.ECommonsHttpMethod.DELETE, url, params, headers, true, options.returnRawResult || false, options.timeout); | ||
} | ||
internalPost(script, body, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestPostPutPatch(tscommons_http_4.ECommonsHttpMethod.POST, script, body, this.contentType, params, headers, true, options.returnRawResult || false, options.timeout); | ||
internalPost(url, body, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestPostPutPatch(tscommons_http_4.ECommonsHttpMethod.POST, url, body, this.contentType, params, headers, true, options.returnRawResult || false, options.timeout); | ||
} | ||
internalPut(script, body, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestPostPutPatch(tscommons_http_4.ECommonsHttpMethod.PUT, script, body, this.contentType, params, headers, true, options.returnRawResult || false, options.timeout); | ||
internalPut(url, body, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestPostPutPatch(tscommons_http_4.ECommonsHttpMethod.PUT, url, body, this.contentType, params, headers, true, options.returnRawResult || false, options.timeout); | ||
} | ||
internalPatch(script, body, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestPostPutPatch(tscommons_http_4.ECommonsHttpMethod.PATCH, script, body, this.contentType, params, headers, true, options.returnRawResult || false, options.timeout); | ||
internalPatch(url, body, params, headers, options) { | ||
return CommonsInternalHttpClientImplementation.requestPostPutPatch(tscommons_http_4.ECommonsHttpMethod.PATCH, url, body, this.contentType, params, headers, true, options.returnRawResult || false, options.timeout); | ||
} | ||
@@ -143,0 +143,0 @@ } |
{ | ||
"name": "nodecommons-rest", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "", | ||
@@ -16,8 +16,8 @@ "scripts": { | ||
"form-urlencoded": "^4.1.4", | ||
"nodecommons-express": "^1.4.8", | ||
"nodecommons-security": "^3.0.1", | ||
"nodecommons-url": "^1.1.4", | ||
"nodecommons-express": "^1.4.9", | ||
"nodecommons-security": "^3.0.2", | ||
"nodecommons-url": "^1.1.5", | ||
"tscommons-core": "^2.0.0", | ||
"tscommons-http": "^4.1.0", | ||
"tscommons-session": "0.0.4" | ||
"tscommons-session": "0.0.5" | ||
}, | ||
@@ -24,0 +24,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
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
62830
6
+ Addedgopd@1.0.1(transitive)
+ Addedtscommons-session@0.0.5(transitive)
- Removedgopd@1.1.0(transitive)
- Removedtscommons-core@1.33.1(transitive)
- Removedtscommons-session@0.0.4(transitive)
Updatednodecommons-express@^1.4.9
Updatednodecommons-security@^3.0.2
Updatednodecommons-url@^1.1.5
Updatedtscommons-session@0.0.5