@hapi/shot
Advanced tools
Comparing version 5.0.5 to 6.0.0-beta.0
@@ -17,3 +17,3 @@ 'use strict'; | ||
super({ | ||
emitClose: !!(options.simulate && options.simulate.close), | ||
emitClose: !!(options.simulate?.close), | ||
autoDestroy: true // This is the default in node 14+ | ||
@@ -36,3 +36,3 @@ }); | ||
this.headers = {}; | ||
const headers = options.headers || {}; | ||
const headers = options.headers ?? {}; | ||
const fields = Object.keys(headers); | ||
@@ -44,3 +44,3 @@ fields.forEach((field) => { | ||
this.headers['user-agent'] = this.headers['user-agent'] || 'shot'; | ||
this.headers['user-agent'] = this.headers['user-agent'] ?? 'shot'; | ||
@@ -60,9 +60,10 @@ const hostHeaderFromUri = function () { | ||
this.headers.host = this.headers.host || hostHeaderFromUri() || options.authority || 'localhost:80'; | ||
this.headers.host = this.headers.host ?? hostHeaderFromUri() ?? options.authority ?? 'localhost:80'; | ||
this.connection = { | ||
remoteAddress: options.remoteAddress || '127.0.0.1' | ||
// NOTE connection is deprecated in favor of socket as of node v13 | ||
this.socket = this.connection = { | ||
remoteAddress: options.remoteAddress ?? '127.0.0.1' | ||
}; | ||
let payload = options.payload || null; | ||
let payload = options.payload ?? null; | ||
if (payload && | ||
@@ -91,3 +92,3 @@ typeof payload !== 'string' && | ||
isDone: false, | ||
simulate: options.simulate || {} | ||
simulate: options.simulate ?? {} | ||
}; | ||
@@ -94,0 +95,0 @@ |
{ | ||
"name": "@hapi/shot", | ||
"description": "Injects a fake HTTP request/response into a node HTTP server", | ||
"version": "5.0.5", | ||
"version": "6.0.0-beta.0", | ||
"repository": "git://github.com/hapijs/shot", | ||
@@ -16,2 +16,7 @@ "main": "lib/index.js", | ||
], | ||
"eslintConfig": { | ||
"extends": [ | ||
"plugin:@hapi/module" | ||
] | ||
}, | ||
"dependencies": { | ||
@@ -22,4 +27,5 @@ "@hapi/hoek": "9.x.x", | ||
"devDependencies": { | ||
"@hapi/code": "8.x.x", | ||
"@hapi/lab": "24.x.x" | ||
"@hapi/code": "9.0.0-beta.0", | ||
"@hapi/eslint-plugin": "*", | ||
"@hapi/lab": "25.0.0-beta.0" | ||
}, | ||
@@ -26,0 +32,0 @@ "scripts": { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13179
260
3
2