core-functions
Advanced tools
Comparing version 2.0.11 to 2.0.12
@@ -221,3 +221,3 @@ "use strict"; | ||
// Determine which HTTP status codes are allowed to pass through | ||
let allowedStatusCodes = Array.isArray(allowedHttpStatusCodes) ? allowedHttpStatusCodes.map(toHttpStatus) : undefined; | ||
const allowedStatusCodes = Array.isArray(allowedHttpStatusCodes) ? allowedHttpStatusCodes.map(toHttpStatus) : undefined; | ||
@@ -227,6 +227,6 @@ // Force inclusion of mandatory 400 and 500 | ||
if (allowedStatusCodes.indexOf(400) === -1) { | ||
allowedStatusCodes = allowedStatusCodes.concat(400); | ||
allowedStatusCodes.push(400); | ||
} | ||
if (allowedStatusCodes.indexOf(500) === -1) { | ||
allowedStatusCodes = allowedStatusCodes.concat(500); | ||
allowedStatusCodes.push(500); | ||
} | ||
@@ -399,3 +399,4 @@ } | ||
toAppError: toAppError, | ||
toAppErrorForApiGateway: toAppErrorForApiGateway | ||
toAppErrorForApiGateway: toAppErrorForApiGateway, | ||
getHttpStatus: getHttpStatus | ||
}; |
{ | ||
"name": "core-functions", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"description": "Core functions, utilities and classes for working with Node/JavaScript primitives and built-in objects, including strings, booleans, Promises, base 64, Arrays, Objects, standard AppErrors, etc.", | ||
@@ -5,0 +5,0 @@ "author": "Byron du Preez", |
@@ -1,2 +0,2 @@ | ||
# core-functions v2.0.11 | ||
# core-functions v2.0.12 | ||
@@ -106,2 +106,4 @@ Core functions, utilities and classes for working with Node/JavaScript primitives and built-in objects, including | ||
### 2.0.12 | ||
- Changed `app-errors.js` module to export `getHttpStatus` function | ||
@@ -108,0 +110,0 @@ ### 2.0.11 |
@@ -407,1 +407,24 @@ 'use strict'; | ||
}); | ||
test('toAppError attempt to recreate NOT instanceof BadRequest bug', t => { | ||
const cause = new TypeError('TE1'); | ||
const br1 = new BadRequest('BR1', undefined, cause); | ||
t.ok(br1 instanceof BadRequest, `br1 must be instanceof BadRequest`); | ||
t.ok(br1 instanceof Error, `br1 must be instanceof Error`); | ||
t.equals(br1.cause, cause.toString(), `br1.cause must be ${cause.toString()}`); | ||
const br2 = toAppError(br1); | ||
t.equals(br2, br1, `br2 must be same instance as br1`); | ||
t.ok(br2 instanceof BadRequest, `br2 must be instanceof BadRequest`); | ||
const br3 = toAppError(br1, 'BR1'); | ||
t.equals(br3, br1, `br3 must be same instance as br1`); | ||
t.ok(br3 instanceof BadRequest, `br3 must be instanceof BadRequest`); | ||
const br4 = toAppError(br1, 'BR4'); | ||
t.notEquals(br4, br1, `br4 must NOT be same instance as br1`); | ||
t.ok(br4 instanceof BadRequest, `br4 must be instanceof BadRequest`); | ||
t.equals(br4.cause, cause.toString(), `br4.cause must be ${cause.toString()}`); | ||
t.end(); | ||
}); |
{ | ||
"name": "core-functions-tests", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"author": "Byron du Preez", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.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
221534
4252
197