Files
goto/apps/web/e2e/redirect.e2e.ts
eleith 7bb3a1b331
ci/woodpecker/pr/cli Pipeline was successful
ci/woodpecker/pr/config Pipeline was successful
ci/woodpecker/pr/web Pipeline was successful
ci/woodpecker/push/cli Pipeline was successful
ci/woodpecker/push/config Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
test(web): cover redirects and HMR lifecycle
2026-11-01 10:19:35 -08:00

25 lines
857 B
TypeScript

import { expect, test } from './support/test.ts';
test('the Node boundary preserves domains and raw paths before framework routing', async ({
request
}) => {
for (const [host, path, destination] of [
['go.example.org', '/docs', 'first-domain'],
['tiny.example.org', '/docs', 'second-domain'],
['go.example.org', '/a%2Fb', 'decoded'],
['go.example.org', '/a%252Fb', 'literal-percent'],
['go.example.org', '/healthz', 'public-health']
]) {
const response = await request.get(path!, { headers: { host: host! }, maxRedirects: 0 });
expect(response.status()).toBe(302);
expect(response.headers().location).toBe(`https://example.org/${destination}`);
}
const head = await request.head('/docs', {
headers: { host: 'go.example.org' },
maxRedirects: 0
});
expect(head.status()).toBe(302);
expect(await head.body()).toHaveLength(0);
});