Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/integration/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ for (const {
expect(response.status).toBe(307)
expect(response.headers.get('location'), 'added a location header').toBeTypeOf('string')
expect(
new URL(response.headers.get('location') as string).pathname,
new URL(response.headers.get('location') as string, 'http://n').pathname,
Copy link
Contributor Author

@pieh pieh Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added base here (and few other tests) because relative location without it just fails to construct URL object and throws Invalid URL. We do assert on pathname URL portion anyway so base will be discarded on actual assertion

'redirected to the correct path',
).toEqual('/other')
expect(response.headers.get('x-runtime')).toEqual(expectedRuntime)
Expand All @@ -154,7 +154,7 @@ for (const {
expect(response.status).toBe(307)
expect(response.headers.get('location'), 'added a location header').toBeTypeOf('string')
expect(
new URL(response.headers.get('location') as string).pathname,
new URL(response.headers.get('location') as string, 'http://n').pathname,
'redirected to the correct path',
).toEqual('/other')
expect(response.headers.get('x-header-from-redirect'), 'hello').toBe('hello')
Expand Down Expand Up @@ -357,7 +357,7 @@ for (const {
expect(response.status).toBe(307)
expect(response.headers.get('location'), 'added a location header').toBeTypeOf('string')
expect(
new URL(response.headers.get('location') as string).pathname,
new URL(response.headers.get('location') as string, 'http://n').pathname,
'redirected to the correct path',
).toEqual('/other')
expect(response.headers.get('x-header-from-redirect'), 'hello').toBe('hello')
Expand All @@ -382,7 +382,7 @@ for (const {
expect(response.status).toBe(307)
expect(response.headers.get('location'), 'added a location header').toBeTypeOf('string')
expect(
new URL(response.headers.get('location') as string).pathname,
new URL(response.headers.get('location') as string, 'http://n').pathname,
'redirected to the correct path',
).toEqual('/other')
expect(response.headers.get('x-header-from-redirect'), 'hello').toBe('hello')
Expand Down
Loading