Skip to content

Commit

Permalink
Don't try to read headers when page was closed
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Jan 14, 2025
1 parent 5e21862 commit 0a18c69
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/e2e/app-dir/actions/app-action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,11 +888,13 @@ describe('app-dir action handling', () => {
async (runtime) => {
let redirectResponseCode
const browser = await next.browser(`/delayed-action/${runtime}`, {
beforePageLoad(page) {
beforePageLoad(page: Page) {
page.on('response', async (res: Response) => {
const headers = await res.allHeaders()
if (headers['x-action-redirect']) {
redirectResponseCode = res.status()
if (!page.isClosed()) {
const headers = await res.allHeaders()
if (headers['x-action-redirect']) {
redirectResponseCode = res.status()
}
}
})
},
Expand Down

0 comments on commit 0a18c69

Please sign in to comment.