Skip to content

Commit 71be407

Browse files
committed
Fix CONTENT_TYPE and CONTENT_LENGTH handling
Fixes #15
1 parent f1d18ed commit 71be407

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/request.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,12 @@ Request.prototype._createReqRes = function () {
122122

123123
for (var param in this.params) {
124124
if (HEADER_EXPR.test(param) || param === 'CONTENT_LENGTH' || param === 'CONTENT_TYPE') {
125-
var name = param.slice(5).replace(UNDERSCORE_EXPR, '-');
125+
var name = param.replace(HEADER_EXPR, '').replace(UNDERSCORE_EXPR, '-');
126+
127+
// Ignore HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH
128+
if (HEADER_EXPR.test(param) && (name.toLowerCase() === 'content-type' || name.toLowerCase() === 'content-length'))
129+
continue;
130+
126131
var value = this.params[param];
127132
raw.push(name, value);
128133
this._req._addHeaderLine(name, value, dest);

0 commit comments

Comments
 (0)