Skip to content

Commit 9bc53d8

Browse files
committed
http: make DELETE requests set req.method
Fixes nodejs#6461.
1 parent 962686b commit 9bc53d8

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

lib/_http_common.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var IncomingMessage = incoming.IncomingMessage;
2727
var readStart = incoming.readStart;
2828
var readStop = incoming.readStop;
2929

30+
var isNumber = require('util').isNumber;
3031
var debug = require('util').debuglog('http');
3132
exports.debug = debug;
3233

@@ -90,7 +91,7 @@ function parserOnHeadersComplete(info) {
9091

9192
parser.incoming._addHeaderLines(headers, n);
9293

93-
if (info.method) {
94+
if (isNumber(info.method)) {
9495
// server only
9596
parser.incoming.method = HTTPParser.methods[info.method];
9697
} else {

test/simple/test-http-request-methods.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ var assert = require('assert');
2424
var net = require('net');
2525
var http = require('http');
2626

27-
// Test that the PATCH and PURGE verbs get passed through correctly
27+
// Test that the DELETE, PATCH and PURGE verbs get passed through correctly
2828

29-
['PATCH', 'PURGE'].forEach(function(method, index) {
29+
['DELETE', 'PATCH', 'PURGE'].forEach(function(method, index) {
3030
var port = common.PORT + index;
3131

3232
var server_response = '';

0 commit comments

Comments
 (0)