@hapi/h2o2
Advanced tools
Comparing version 9.1.0 to 10.0.0
@@ -5,2 +5,3 @@ 'use strict'; | ||
const Https = require('https'); | ||
const Url = require('url'); | ||
@@ -68,5 +69,4 @@ const Hoek = require('@hapi/hoek'); | ||
requirements: { | ||
hapi: '>=19.0.0' | ||
hapi: '>=20.0.0' | ||
}, | ||
register: function (server, options) { | ||
@@ -88,3 +88,3 @@ | ||
Hoek.assert(!route.settings.payload || ((route.settings.payload.output === 'data' || route.settings.payload.output === 'stream') && !route.settings.payload.parse), 'Cannot proxy if payload is parsed or if output is not stream or data'); | ||
settings.mapUri = handlerOptions.mapUri || internals.mapUri(handlerOptions.protocol, handlerOptions.host, handlerOptions.port, handlerOptions.uri); | ||
settings.mapUri = handlerOptions.mapUri ?? internals.mapUri(handlerOptions.protocol, handlerOptions.host, handlerOptions.port, handlerOptions.uri); | ||
@@ -164,3 +164,3 @@ if (settings.ttl === 'upstream') { | ||
if (settings.downstreamResponseTime) { | ||
downstreamStartTime = process.hrtime(); | ||
downstreamStartTime = process.hrtime.bigint(); | ||
} | ||
@@ -182,4 +182,4 @@ | ||
if (settings.downstreamResponseTime) { | ||
const downstreamResponseTime = process.hrtime(downstreamStartTime); | ||
request.log(['h2o2', 'success'], { downstreamResponseTime: downstreamResponseTime[0] * internals.NS_PER_SEC + downstreamResponseTime[1] }); | ||
const downstreamResponseTime = Number(process.hrtime.bigint() - downstreamStartTime); | ||
request.log(['h2o2', 'success'], { downstreamResponseTime }); | ||
} | ||
@@ -189,4 +189,4 @@ } | ||
if (settings.downstreamResponseTime) { | ||
const downstreamResponseTime = process.hrtime(downstreamStartTime); | ||
request.log(['h2o2', 'error'], { downstreamResponseTime: downstreamResponseTime[0] * internals.NS_PER_SEC + downstreamResponseTime[1] }); | ||
const downstreamResponseTime = Number(process.hrtime.bigint() - downstreamStartTime); | ||
request.log(['h2o2', 'error'], { downstreamResponseTime }); | ||
} | ||
@@ -254,3 +254,4 @@ | ||
.replace(/{port}/g, request.server.info.port) | ||
.replace(/{path}/g, request.path); | ||
.replace(/{path}/g, request.path) | ||
.replace(/{query}/g, request.url.search || ''); | ||
@@ -275,6 +276,6 @@ Object.keys(request.params).forEach((key) => { | ||
protocol = protocol || 'http:'; | ||
protocol = protocol ?? 'http:'; | ||
port = port || (protocol === 'http:' ? 80 : 443); | ||
const baseUrl = protocol + '//' + host + ':' + port; | ||
port = port ?? (protocol === 'http:' ? 80 : 443); | ||
const baseUrl = Url.format({ protocol, hostname: host, port }); | ||
@@ -281,0 +282,0 @@ return function (request) { |
@@ -1,3 +0,4 @@ | ||
Copyright (c) 2012-2020, Sideway Inc, and project contributors | ||
Copyright (c) 2012-2014, Walmart. | ||
Copyright (c) 2012-2022, Project contributors | ||
Copyright (c) 2012-2020, Sideway Inc | ||
Copyright (c) 2012-2014, Walmart. | ||
All rights reserved. | ||
@@ -4,0 +5,0 @@ |
{ | ||
"name": "@hapi/h2o2", | ||
"description": "Proxy handler plugin for hapi.js", | ||
"version": "9.1.0", | ||
"version": "10.0.0", | ||
"repository": "git://github.com/hapijs/h2o2", | ||
"main": "lib/index.js", | ||
"engines": { | ||
"node": ">=12.0.0" | ||
"node": ">=14.0.0" | ||
}, | ||
@@ -20,14 +20,20 @@ "files": [ | ||
], | ||
"eslintConfig": { | ||
"extends": [ | ||
"plugin:@hapi/module" | ||
] | ||
}, | ||
"dependencies": { | ||
"@hapi/boom": "9.x.x", | ||
"@hapi/hoek": "9.x.x", | ||
"@hapi/validate": "1.x.x", | ||
"@hapi/wreck": "17.x.x" | ||
"@hapi/boom": "^10.0.0", | ||
"@hapi/hoek": "^10.0.0", | ||
"@hapi/validate": "^2.0.0", | ||
"@hapi/wreck": "^18.0.0" | ||
}, | ||
"devDependencies": { | ||
"@hapi/code": "8.x.x", | ||
"@hapi/hapi": "20.x.x", | ||
"@hapi/inert": "6.x.x", | ||
"@hapi/lab": "24.x.x", | ||
"@hapi/teamwork": "5.x.x" | ||
"@hapi/code": "^9.0.0", | ||
"@hapi/eslint-plugin": "^6.0.0", | ||
"@hapi/hapi": "^21.0.0-beta.1", | ||
"@hapi/inert": "^7.0.0", | ||
"@hapi/lab": "^25.0.1", | ||
"@hapi/teamwork": "^6.0.0" | ||
}, | ||
@@ -34,0 +40,0 @@ "scripts": { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
13157
234
2
6
+ Added@hapi/boom@10.0.1(transitive)
+ Added@hapi/hoek@10.0.111.0.7(transitive)
+ Added@hapi/topo@6.0.2(transitive)
+ Added@hapi/validate@2.0.1(transitive)
- Removed@hapi/boom@9.1.4(transitive)
- Removed@hapi/hoek@9.3.0(transitive)
- Removed@hapi/topo@5.1.0(transitive)
- Removed@hapi/validate@1.1.3(transitive)
Updated@hapi/boom@^10.0.0
Updated@hapi/hoek@^10.0.0
Updated@hapi/validate@^2.0.0
Updated@hapi/wreck@^18.0.0