@f5devcentral/atg-shared-utilities
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -15,2 +15,6 @@ # Changelog | ||
## [0.10.0] - 2023-07-17 | ||
### Added | ||
- Added `rejectErrStatusCodes` option to `requestUtils.send` | ||
## [0.9.0] - 2023-07-11 | ||
@@ -17,0 +21,0 @@ ### Added |
{ | ||
"name": "@f5devcentral/atg-shared-utilities", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "lint": "eslint .", |
@@ -43,2 +43,4 @@ /** | ||
* @param {boolean} [options.returnResponseObj] - If true, returns the response object instead of just the body | ||
* @param {boolean} [options.rejectErrStatusCodes=true] - If true, rejects the promise when a response with a | ||
* 400+ status code is received. Defaults to true | ||
* @returns {Promise} Promise object that resolves with either the response body or the response object depending on | ||
@@ -49,3 +51,6 @@ * the options that are provided | ||
const reqOpts = JSON.parse(JSON.stringify(requestOptions)); | ||
const opts = options || {}; | ||
const defaultOptions = { | ||
rejectErrStatusCodes: true | ||
}; | ||
const opts = Object.assign(defaultOptions, options); | ||
let protocol = https; | ||
@@ -107,3 +112,3 @@ let jsonBody; | ||
if (response.statusCode >= 400) { | ||
if (response.statusCode >= 400 && opts.rejectErrStatusCodes) { | ||
if (DEBUG) { | ||
@@ -110,0 +115,0 @@ console.error(response.statusCode, buffer); |
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
79694
1526