standard-http-error
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -0,1 +1,13 @@ | ||
## 2.0.0 (Oct 4, 2015) | ||
- Updates HTTP status codes and constants from Node v4: | ||
Code | Old Name | New Name | ||
------|-----------------------------------|--------- | ||
`302` | `MOVED_TEMPORARILY` | `FOUND` | ||
`408` | `REQUEST_TIME_OUT` | `REQUEST_TIMEOUT` | ||
`413` | `REQUEST_ENTITY_TOO_LARGE` | `PAYLOAD_TOO_LARGE` | ||
`414` | `REQUEST_URI_TOO_LARGE` | `URI_TOO_LONG` | ||
`416` | `REQUESTED_RANGE_NOT_SATISFIABLE` | `RANGE_NOT_SATISFIABLE` | ||
`504` | `GATEWAY_TIME_OUT` | `GATEWAY_TIMEOUT` | ||
## 1.2.0 (Oct 4, 2015) | ||
@@ -2,0 +14,0 @@ - Restores status code names and constants to pre Node v4 times (Node v0.12) for |
@@ -17,3 +17,3 @@ { | ||
"301": "Moved Permanently", | ||
"302": "Moved Temporarily", | ||
"302": "Found", | ||
"303": "See Other", | ||
@@ -32,3 +32,3 @@ "304": "Not Modified", | ||
"407": "Proxy Authentication Required", | ||
"408": "Request Time-out", | ||
"408": "Request Timeout", | ||
"409": "Conflict", | ||
@@ -38,6 +38,6 @@ "410": "Gone", | ||
"412": "Precondition Failed", | ||
"413": "Request Entity Too Large", | ||
"414": "Request-URI Too Large", | ||
"413": "Payload Too Large", | ||
"414": "URI Too Long", | ||
"415": "Unsupported Media Type", | ||
"416": "Requested Range Not Satisfiable", | ||
"416": "Range Not Satisfiable", | ||
"417": "Expectation Failed", | ||
@@ -58,3 +58,3 @@ "418": "I'm a teapot", | ||
"503": "Service Unavailable", | ||
"504": "Gateway Time-out", | ||
"504": "Gateway Timeout", | ||
"505": "HTTP Version Not Supported", | ||
@@ -61,0 +61,0 @@ "506": "Variant Also Negotiates", |
{ | ||
"name": "standard-http-error", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "Standard HTTP error class. Proper serialization, no bloat. Extensible.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -181,3 +181,3 @@ StandardHttpError.js | ||
`301` | `MOVED_PERMANENTLY` | ||
`302` | `MOVED_TEMPORARILY` | ||
`302` | `FOUND` | ||
`303` | `SEE_OTHER` | ||
@@ -196,3 +196,3 @@ `304` | `NOT_MODIFIED` | ||
`407` | `PROXY_AUTHENTICATION_REQUIRED` | ||
`408` | `REQUEST_TIME_OUT` | ||
`408` | `REQUEST_TIMEOUT` | ||
`409` | `CONFLICT` | ||
@@ -202,6 +202,6 @@ `410` | `GONE` | ||
`412` | `PRECONDITION_FAILED` | ||
`413` | `REQUEST_ENTITY_TOO_LARGE` | ||
`414` | `REQUEST_URI_TOO_LARGE` | ||
`413` | `PAYLOAD_TOO_LARGE` | ||
`414` | `URI_TOO_LONG` | ||
`415` | `UNSUPPORTED_MEDIA_TYPE` | ||
`416` | `REQUESTED_RANGE_NOT_SATISFIABLE` | ||
`416` | `RANGE_NOT_SATISFIABLE` | ||
`417` | `EXPECTATION_FAILED` | ||
@@ -222,3 +222,3 @@ `418` | `IM_A_TEAPOT` | ||
`503` | `SERVICE_UNAVAILABLE` | ||
`504` | `GATEWAY_TIME_OUT` | ||
`504` | `GATEWAY_TIMEOUT` | ||
`505` | `HTTP_VERSION_NOT_SUPPORTED` | ||
@@ -225,0 +225,0 @@ `506` | `VARIANT_ALSO_NEGOTIATES` |
var O = require("oolong") | ||
var isVersion = require("semver").satisfies.bind(null, process.version) | ||
var describeNodeV012 = isVersion(">= 0.12 < 0.13") ? describe : xdescribe | ||
var CODES_JSON = require("../codes.json") | ||
var STATUS_CODES = require("http").STATUS_CODES | ||
describeNodeV012("codes.json", function() { | ||
;(isVersion(">= 4") ? describe : xdescribe)("codes.json", function() { | ||
// Test for superset rather than equivalence because future Node versions | ||
@@ -9,0 +8,0 @@ // might _add_ status codes. During the switch from Node 0.12 to Node v4 some |
var O = require("oolong") | ||
var HttpError = require("..") | ||
var isVersion = require("semver").satisfies.bind(null, process.version) | ||
var describeNodeV012 = isVersion(">= 0.12 < 0.13") ? describe : xdescribe | ||
var describeNodeV4 = isVersion(">= 4 < 5") ? describe : xdescribe | ||
@@ -167,3 +166,9 @@ | ||
describeNodeV012("when on Node v0.12", function() { | ||
// Changed between Node v0.12 and Node v4. | ||
it("must have FOUND equal 302", function() { | ||
HttpError.must.have.property("FOUND", 302) | ||
new HttpError(302).message.must.equal("Found") | ||
}) | ||
describeNodeV4("when on Node v4", function() { | ||
var STATUS_NAMES = require("http-codes") | ||
@@ -181,31 +186,3 @@ | ||
}) | ||
describeNodeV4("when on Node v4", function() { | ||
O.each({ | ||
MOVED_TEMPORARILY: 302, // => FOUND | ||
REQUEST_TIME_OUT: 408, // => REQUEST_TIMEOUT | ||
REQUEST_ENTITY_TOO_LARGE: 413, // => PAYLOAD_TOO_LARGE | ||
REQUEST_URI_TOO_LARGE: 414, // => URI_TOO_LONG | ||
REQUESTED_RANGE_NOT_SATISFIABLE: 416, // => RANGE_NOT_SATISFIABLE | ||
GATEWAY_TIME_OUT: 504 // => GATEWAY_TIMEOUT | ||
}, function(code, name) { | ||
it("must have " + name + " equal " + code, function() { | ||
HttpError[name].must.equal(code) | ||
}) | ||
}) | ||
O.each({ | ||
302: "Moved Temporarily", | ||
408: "Request Time-out", | ||
413: "Request Entity Too Large", | ||
414: "Request-URI Too Large", | ||
416: "Requested Range Not Satisfiable", | ||
504: "Gateway Time-out" | ||
}, function(name, code) { | ||
it("must have " + name + " equal " + code, function() { | ||
new HttpError(Number(code)).message.must.equal(name) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
23013
274