This commit is contained in:
Chris Wanstrath 2026-02-17 07:55:05 -08:00
parent 3ac9a06a9f
commit 64b92f0975

View File

@ -113,6 +113,8 @@ export function connect(options: TunnelOptions): Tunnel {
const url = `${target}${req.path}`
const hasBody = req.method !== "GET" && req.method !== "HEAD" && req.body
console.log(`[tunnel] >> ${req.method} ${url}`, { contentType: req.headers["content-type"], bodyLen: req.body?.length, hasBody })
const response = await fetch(url, {
method: req.method,
headers: req.headers,
@ -121,6 +123,7 @@ export function connect(options: TunnelOptions): Tunnel {
})
const contentType = response.headers.get("content-type")
console.log(`[tunnel] << ${response.status} ${req.method} ${url}`, { contentType, location: response.headers.get("location") })
const headers: Record<string, string> = {}
response.headers.forEach((value, key) => {
headers[key] = value