light-my-request
Advanced tools
Comparing version 4.4.4 to 4.5.0
@@ -68,2 +68,3 @@ import * as stream from 'stream' | ||
headers: http.IncomingHttpHeaders | ||
rawHeaders: string[] | ||
prepare: (next: () => void) => void | ||
@@ -70,0 +71,0 @@ // @deprecated |
@@ -66,2 +66,3 @@ 'use strict' | ||
this.headers = {} | ||
this.rawHeaders = [] | ||
const headers = options.headers || {} | ||
@@ -111,2 +112,6 @@ | ||
for (const header of Object.keys(this.headers)) { | ||
this.rawHeaders.push(header, this.headers[header]) | ||
} | ||
// Use _lightMyRequest namespace to avoid collision with Node | ||
@@ -113,0 +118,0 @@ this._lightMyRequest = { |
{ | ||
"name": "light-my-request", | ||
"version": "4.4.4", | ||
"version": "4.5.0", | ||
"description": "Fake HTTP injection library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -89,2 +89,16 @@ 'use strict' | ||
test('request has rawHeaders', (t) => { | ||
t.plan(3) | ||
const dispatch = function (req, res) { | ||
t.ok(Array.isArray(req.rawHeaders)) | ||
t.match(req.rawHeaders, ['super', 'duper', 'user-agent', 'lightMyRequest', 'host', 'example.com:8080']) | ||
res.writeHead(200) | ||
res.end() | ||
} | ||
inject(dispatch, { method: 'GET', url: 'http://example.com:8080/hello', headers: { Super: 'duper' } }, (err, res) => { | ||
t.error(err) | ||
}) | ||
}) | ||
test('passes remote address', (t) => { | ||
@@ -91,0 +105,0 @@ t.plan(2) |
Sorry, the diff of this file is not supported yet
82866
2288