Skip to content

Commit

Permalink
Fix passing host to warp client
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <[email protected]>
  • Loading branch information
mcandeia committed Jul 19, 2024
1 parent df2b489 commit 3385e45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deco/warp",
"version": "0.2.7",
"version": "0.2.8",
"exports": "./mod.ts",
"tasks": {
"check": "deno fmt && deno lint && deno check mod.ts"
Expand Down
19 changes: 12 additions & 7 deletions handlers.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,18 @@ async function doFetch(
// Read from the stream
const signal = clientCh.signal;
try {
const response = await fetch(new URL(request.url, state.localAddr), {
...state.client ? { client: state.client } : {},
method: request.method,
headers: request.headers,
body: request.body,
signal,
});
const response = await fetch(
new URL(request.url, state.localAddr),
{
...state.client ? { client: state.client } : {},
method: request.method,
headers: state.client
? { ...request.headers, host: request.domain }
: request.headers,
body: request.body,
signal,
},
);
await clientCh.send({
type: "response-start",
id: request.id,
Expand Down

0 comments on commit 3385e45

Please sign in to comment.