@fastify/http-proxy
Advanced tools
Comparing version 8.2.2 to 8.2.3
@@ -203,3 +203,3 @@ 'use strict' | ||
function rewriteHeaders (headers) { | ||
function rewriteHeaders (headers, req) { | ||
const location = headers.location | ||
@@ -210,3 +210,3 @@ if (location && !isExternalUrl(location)) { | ||
if (oldRewriteHeaders) { | ||
headers = oldRewriteHeaders(headers) | ||
headers = oldRewriteHeaders(headers, req) | ||
} | ||
@@ -213,0 +213,0 @@ return headers |
{ | ||
"name": "@fastify/http-proxy", | ||
"version": "8.2.2", | ||
"version": "8.2.3", | ||
"description": "proxy http requests, for Fastify", | ||
@@ -50,3 +50,3 @@ "main": "index.js", | ||
"tap": "^16.0.0", | ||
"tsd": "^0.22.0", | ||
"tsd": "^0.24.1", | ||
"typescript": "^4.5.4", | ||
@@ -53,0 +53,0 @@ "why-is-node-running": "^2.2.2" |
@@ -390,3 +390,6 @@ 'use strict' | ||
replyOptions: { | ||
rewriteHeaders: headers => Object.assign({ 'x-test': 'test' }, headers) | ||
rewriteHeaders: (headers, req) => Object.assign({ | ||
'x-test': 'test', | ||
'x-req': req.headers['x-req'] | ||
}, headers) | ||
} | ||
@@ -401,6 +404,9 @@ }) | ||
const { headers } = await got( | ||
`http://localhost:${proxyServer.server.address().port}/api` | ||
) | ||
t.match(headers, { 'x-test': 'test' }) | ||
const { headers } = await got({ | ||
url: `http://localhost:${proxyServer.server.address().port}/api`, | ||
headers: { | ||
'x-req': 'from-header' | ||
} | ||
}) | ||
t.match(headers, { 'x-test': 'test', 'x-req': 'from-header' }) | ||
}) | ||
@@ -407,0 +413,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
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
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
56078
1462
6