Skip to content

Commit 043c152

Browse files
committed
Bump http-method
1 parent b555f06 commit 043c152

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

default-handler.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ function createDefaultHandler(opts) {
1212
if (err) {
1313
if (err.statusCode === 404) {
1414
return notFound(req, res, err)
15+
} else if (err.statusCode === 405) {
16+
return methodNotAllowed(req, res, err)
1517
}
16-
1718
errorHandler(req, res, err)
1819
}
1920
}
@@ -30,3 +31,8 @@ function defaultNotFound(req, res) {
3031
res.statusCode = 404
3132
res.end("404 Not Found")
3233
}
34+
35+
function methodNotAllowed(req, res, err) {
36+
res.statusCode = err.statusCode
37+
res.end(err.message)
38+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"error": "^3.0.0",
2121
"hammock": "^0.1.9",
22-
"http-methods": "~0.1.0",
22+
"http-methods": "~1.1.0",
2323
"httperr": "^0.5.0",
2424
"inherits": "^2.0.1",
2525
"routes": "^2.1.0",

test/prefix-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ test("prefix supports object format", function (assert) {
9292

9393
assert.equal(resp.statusCode, 405)
9494
assert.equal(resp.body,
95-
"405 Method Not Allowed /foo")
95+
"405 Method Not Allowed")
9696

9797
assert.end()
9898
}))

0 commit comments

Comments
 (0)