Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
penalosa committed Feb 16, 2024
1 parent 5306d0a commit e9ef80d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
6 changes: 0 additions & 6 deletions fixtures/worker-app/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ export default {
secure: true,
}),
],
[
"Set-Cookie",
cookie.serialize("hello2", "world2", {
domain: `${hostname}:1`,
}),
],
],
});

Expand Down
5 changes: 2 additions & 3 deletions fixtures/worker-app/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,8 @@ describe("'wrangler dev' correctly renders pages", () => {
const response = await fetch(`http://${ip}:${port}/cookie`);
expect(response.headers.getSetCookie()).toMatchInlineSnapshot(`
[
"hello=world; Domain=prod.example.org",
"hello2=world2; Domain=prod.example.org; Secure",
"hello2=world2; Domain=prod.example.org:1",
"hello=world; Domain=localhost",
"hello2=world2; Domain=localhost; Secure",
]
`);
});
Expand Down
8 changes: 6 additions & 2 deletions packages/wrangler/templates/startDevWorker/ProxyWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
} as ExportedHandler<Env, unknown, ProxyWorkerIncomingRequestBody>;

export class ProxyWorker implements DurableObject {
constructor(readonly state: DurableObjectState, readonly env: Env) {}
constructor(readonly state: DurableObjectState, readonly env: Env) { }

proxyData?: ProxyData;
requestQueue = new Map<Request, DeferredPromise<Response>>();
Expand Down Expand Up @@ -316,7 +316,11 @@ function rewriteUrlRelatedHeaders(headers: Headers, from: URL, to: URL) {
);
}
headers.forEach((value, key) => {
if (typeof value === "string" && value.includes(from.host)) {
if (
typeof value === "string" &&
value.includes(from.host) &&
key !== "set-cookie"
) {
headers.set(
key,
value.replaceAll(from.origin, to.origin).replaceAll(from.host, to.host)
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e9ef80d

Please sign in to comment.