@hapi/shot
Advanced tools
Comparing version 4.1.0 to 4.1.1
@@ -18,3 +18,2 @@ 'use strict'; | ||
this._shot = { headers: null, trailers: {}, payloadChunks: [] }; | ||
this._headers = {}; // This forces node@8 to always render the headers | ||
this.assignSocket(internals.nullSocket()); | ||
@@ -32,2 +31,22 @@ | ||
// Find the headers object if one was provided. If a headers object is present, call setHeader() | ||
// on the first valid header, and then break out of the loop and call writeHead(). By calling | ||
// setHeader(), Node will materialize a headers object. | ||
const headers = args[args.length - 1]; | ||
if (typeof headers === 'object' && headers !== null) { | ||
const headerNames = Object.keys(headers); | ||
for (let i = 0; i < headerNames.length; ++i) { | ||
const name = headerNames[i]; | ||
try { | ||
this.setHeader(name, headers[name]); | ||
break; | ||
} | ||
catch (ignoreErr) {} // Let the real writeHead() handle errors. | ||
} | ||
} | ||
const result = super.writeHead(...args); | ||
@@ -34,0 +53,0 @@ |
{ | ||
"name": "@hapi/shot", | ||
"description": "Injects a fake HTTP request/response into a node HTTP server", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"repository": "git://github.com/hapijs/shot", | ||
@@ -14,8 +14,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@hapi/hoek": "6.x.x", | ||
"@hapi/hoek": "8.x.x", | ||
"@hapi/joi": "15.x.x" | ||
}, | ||
"devDependencies": { | ||
"@hapi/code": "5.x.x", | ||
"@hapi/lab": "18.x.x" | ||
"@hapi/code": "6.x.x", | ||
"@hapi/lab": "20.x.x" | ||
}, | ||
@@ -22,0 +22,0 @@ "scripts": { |
@@ -0,1 +1,3 @@ | ||
<a href="http://hapijs.com"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a> | ||
# shot | ||
@@ -8,4 +10,2 @@ | ||
Lead Maintainer: [Matt Harrison](https://github.com/mtharrison) | ||
## Example | ||
@@ -12,0 +12,0 @@ |
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
13716
282
- Removed@hapi/hoek@6.2.4(transitive)
Updated@hapi/hoek@8.x.x