Browse Source

http: make DELETE requests set `req.method`

Fixes #6461.
v0.11.9-release
Nathan Rajlich 11 years ago
parent
commit
9bc53d887a
  1. 3
      lib/_http_common.js
  2. 4
      test/simple/test-http-request-methods.js

3
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 {

4
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 = '';

Loading…
Cancel
Save