Compare commits
2 Commits
3ac9a06a9f
...
bf4a803dd3
| Author | SHA1 | Date | |
|---|---|---|---|
| bf4a803dd3 | |||
| 64b92f0975 |
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@because/sneaker",
|
"name": "@because/sneaker",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"description": "http tunnel server and client",
|
"description": "http tunnel server and client",
|
||||||
"module": "src/client.ts",
|
"module": "src/client.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,8 @@ export function connect(options: TunnelOptions): Tunnel {
|
||||||
const url = `${target}${req.path}`
|
const url = `${target}${req.path}`
|
||||||
const hasBody = req.method !== "GET" && req.method !== "HEAD" && req.body
|
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, {
|
const response = await fetch(url, {
|
||||||
method: req.method,
|
method: req.method,
|
||||||
headers: req.headers,
|
headers: req.headers,
|
||||||
|
|
@ -121,6 +123,7 @@ export function connect(options: TunnelOptions): Tunnel {
|
||||||
})
|
})
|
||||||
|
|
||||||
const contentType = response.headers.get("content-type")
|
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> = {}
|
const headers: Record<string, string> = {}
|
||||||
response.headers.forEach((value, key) => {
|
response.headers.forEach((value, key) => {
|
||||||
headers[key] = value
|
headers[key] = value
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user