light-my-request
Advanced tools
Comparing version 5.9.0 to 5.9.1
@@ -126,5 +126,2 @@ 'use strict' | ||
} | ||
if (('origin' in this.headers) === false) { | ||
this.headers.origin = 'http://example.com:8080' | ||
} | ||
this.headers.host = this.headers.host || options.authority || hostHeaderFromURL(parsedURL) | ||
@@ -131,0 +128,0 @@ |
{ | ||
"name": "light-my-request", | ||
"version": "5.9.0", | ||
"version": "5.9.1", | ||
"description": "Fake HTTP injection library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -88,28 +88,2 @@ 'use strict' | ||
test('passes fake origin header', (t) => { | ||
t.plan(2) | ||
const dispatch = function (req, res) { | ||
res.writeHead(200, { 'Content-Type': 'text/plain' }) | ||
res.end(req.headers.origin) | ||
} | ||
inject(dispatch, { method: 'GET', url: 'http://example.com:8080/hello' }, (err, res) => { | ||
t.error(err) | ||
t.equal(res.payload, 'http://example.com:8080') | ||
}) | ||
}) | ||
test('leave intact original origin header', (t) => { | ||
t.plan(2) | ||
const dispatch = function (req, res) { | ||
res.writeHead(200, { 'Content-Type': 'text/plain' }) | ||
res.end(req.headers.origin) | ||
} | ||
inject(dispatch, { method: 'GET', url: 'http://example.com:8080/hello', headers: { origin: 'https://lightmyrequest' } }, (err, res) => { | ||
t.error(err) | ||
t.equal(res.payload, 'https://lightmyrequest') | ||
}) | ||
}) | ||
test('request has rawHeaders', (t) => { | ||
@@ -119,3 +93,3 @@ t.plan(3) | ||
t.ok(Array.isArray(req.rawHeaders)) | ||
t.match(req.rawHeaders, ['super', 'duper', 'user-agent', 'lightMyRequest', 'origin', 'http://example.com:8080', 'host', 'example.com:8080']) | ||
t.match(req.rawHeaders, ['super', 'duper', 'user-agent', 'lightMyRequest', 'host', 'example.com:8080']) | ||
res.writeHead(200) | ||
@@ -1646,3 +1620,2 @@ res.end() | ||
host: 'example.com:8080', | ||
origin: 'http://example.com:8080', | ||
'user-agent': 'lightMyRequest' | ||
@@ -1649,0 +1622,0 @@ }) |
117500
3552