fix host header transform to support Host and host header

This commit is contained in:
Roman Shtylman
2016-11-17 22:28:34 -08:00
parent edc182125f
commit b9c1901d60
3 changed files with 3 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
language: node_js language: node_js
sudo: false
node_js: node_js:
- "4" - "4"
- "6"

View File

@@ -1,5 +1,6 @@
# UNRELEASED # UNRELEASED
* fix host header transform
* update request dependency * update request dependency
# 1.8.1 (2016-01-20) # 1.8.1 (2016-01-20)

View File

@@ -24,7 +24,7 @@ HeaderHostTransformer.prototype._transform = function (chunk, enc, cb) {
// we just become a regular passthrough // we just become a regular passthrough
if (!self.replaced) { if (!self.replaced) {
chunk = chunk.toString(); chunk = chunk.toString();
self.push(chunk.replace(/(\r\nHost: )\S+/, function(match, $1) { self.push(chunk.replace(/(\r\n[Hh]ost: )\S+/, function(match, $1) {
self.replaced = true; self.replaced = true;
return $1 + self.host; return $1 + self.host;
})); }));