response-objects
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -45,3 +45,7 @@ const status = require("statuses"); | ||
function getName (code) { | ||
return status[code].replace(/[\s+-]/g, ""); | ||
const name = status[code]; | ||
if (!name) { | ||
throw new Error(`Unable to find status for ${code}`); | ||
} | ||
return name.replace(/[\s+-]/g, ""); | ||
} | ||
@@ -80,3 +84,3 @@ | ||
let bodyCreator = (code, body /*, headers */) => body != null ? body : status[code]; | ||
let bodyCreator = (code, body /*, headers */) => body != null ? body : (status[code] || `Unknown status for ${code}`); | ||
module.exports.setBodyCreator = f => bodyCreator = f; |
{ | ||
"name": "response-objects", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "simple value objects representing HTTP responses", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
53902
293