summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/_http_common.js3
-rw-r--r--test/simple/test-http-request-methods.js4
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/_http_common.js b/lib/_http_common.js
index 2fb5bd818..7d89b8666 100644
--- a/lib/_http_common.js
+++ b/lib/_http_common.js
@@ -27,6 +27,7 @@ var IncomingMessage = incoming.IncomingMessage;
var readStart = incoming.readStart;
var readStop = incoming.readStop;
+var isNumber = require('util').isNumber;
var debug = require('util').debuglog('http');
exports.debug = debug;
@@ -90,7 +91,7 @@ function parserOnHeadersComplete(info) {
parser.incoming._addHeaderLines(headers, n);
- if (info.method) {
+ if (isNumber(info.method)) {
// server only
parser.incoming.method = HTTPParser.methods[info.method];
} else {
diff --git a/test/simple/test-http-request-methods.js b/test/simple/test-http-request-methods.js
index f0be3a046..33575aed7 100644
--- a/test/simple/test-http-request-methods.js
+++ b/test/simple/test-http-request-methods.js
@@ -24,9 +24,9 @@ var assert = require('assert');
var net = require('net');
var http = require('http');
-// Test that the PATCH and PURGE verbs get passed through correctly
+// Test that the DELETE, PATCH and PURGE verbs get passed through correctly
-['PATCH', 'PURGE'].forEach(function(method, index) {
+['DELETE', 'PATCH', 'PURGE'].forEach(function(method, index) {
var port = common.PORT + index;
var server_response = '';