@argab/request-service
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -112,8 +112,12 @@ "use strict"; | ||
_context.next = 2; | ||
return _this2.onResponse(response, handlers); | ||
return _this2.setResult(response); | ||
case 2: | ||
data.statusCode || (data.statusCode = 200); | ||
_context.next = 4; | ||
return _this2.onResponse(response, handlers); | ||
case 3: | ||
case 4: | ||
data.statusCode || _this2.setStatusCode(response, 200); | ||
case 5: | ||
case "end": | ||
@@ -141,3 +145,3 @@ return _context.stop(); | ||
case 3: | ||
data.statusCode || (data.statusCode = 500); | ||
data.statusCode || _this2.setStatusCode(error, 500); | ||
@@ -168,3 +172,3 @@ case 4: | ||
case 3: | ||
data.statusCode || (data.statusCode = 200); | ||
data.statusCode || _this2.setStatusCode(null, 200); | ||
retry = _this2._retry instanceof Function ? _this2._retry() : _this2.retry(); | ||
@@ -606,2 +610,8 @@ retry === false && _this2._request._resolve(); | ||
}, { | ||
key: "setStatusCode", | ||
value: function setStatusCode(source, def) { | ||
def = Number.isNaN(+def) ? 0 : +def; | ||
this._request.data.statusCode = Number.isNaN(+(source === null || source === void 0 ? void 0 : source.status)) ? def : +source.status; | ||
} | ||
}, { | ||
key: "retry", | ||
@@ -608,0 +618,0 @@ value: function retry(resolve) { |
{ | ||
"name": "@argab/request-service", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Provides a fully customizable Library for handling API using Request repositories and Stubs.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -54,2 +54,3 @@ import {RequestService, Request} from "./Request" | ||
const promise = dataClient instanceof Promise ? dataClient : new Promise(res => setTimeout(() => res(dataClient), 100)) | ||
getLoader()?.start() | ||
@@ -59,4 +60,5 @@ | ||
await this.setResult(response) | ||
await this.onResponse(response, handlers) | ||
data.statusCode || (data.statusCode = 200) | ||
data.statusCode || (this.setStatusCode(response, 200)) | ||
@@ -67,3 +69,3 @@ }).catch(async error => { | ||
await this.onCatch(error, handlers) | ||
data.statusCode || (data.statusCode = 500) | ||
data.statusCode || (this.setStatusCode(error, 500)) | ||
@@ -73,4 +75,5 @@ }).finally(async () => { | ||
getLoader()?.end() | ||
await this.onFinally(handlers) | ||
data.statusCode || (data.statusCode = 200) | ||
data.statusCode || (this.setStatusCode(null, 200)) | ||
@@ -201,2 +204,7 @@ const retry = this._retry instanceof Function ? this._retry() : this.retry() | ||
setStatusCode(source, def) { | ||
def = Number.isNaN(+def) ? 0 : +def | ||
this._request.data.statusCode = Number.isNaN(+source?.status) ? def : +source.status | ||
} | ||
retry(resolve) { | ||
@@ -203,0 +211,0 @@ |
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
117698
2661