hijackresponse
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -96,4 +96,6 @@ var Readable = require('stream').Readable | ||
hijacking = false | ||
res.write = write | ||
res.end = end | ||
return originalResponse | ||
} | ||
} |
{ | ||
"name": "hijackresponse", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Hijack HttpResponses", | ||
@@ -5,0 +5,0 @@ "main": "lib/hijackResponse.js", |
@@ -42,10 +42,13 @@ /* global describe, it */ | ||
hijackResponse(res, passError(handleError, function (res) { | ||
var chunks = [] | ||
res.on('data', function (chunk) { | ||
res.write(chunk) | ||
chunks.push(chunk) | ||
}).on('end', function () { | ||
res.write('qux') | ||
res.end() | ||
res.setHeader('X-qux', 'hijacked') | ||
res.write(Buffer.concat(chunks)) | ||
res.end('qux') | ||
}) | ||
})) | ||
res.setHeader('X-bar', 'hijacked'); | ||
res.on('data', function (chunk) { | ||
@@ -62,3 +65,9 @@ res.write(chunk) | ||
res.end() | ||
}, 'to yield response', 'foobarqux') | ||
}, 'to yield response', { | ||
headers: { | ||
'X-qux': 'hijacked', | ||
'X-bar': 'hijacked' | ||
}, | ||
body: 'foobarqux' | ||
}) | ||
}) | ||
@@ -65,0 +74,0 @@ it('should be able to hijack an already hijacked response when piping', function () { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21909
588