Skip to content

Fix event handling on redirect#5629

Open
ankur22 wants to merge 3 commits intomasterfrom
fix/redirect-request-events
Open

Fix event handling on redirect#5629
ankur22 wants to merge 3 commits intomasterfrom
fix/redirect-request-events

Conversation

@ankur22
Copy link
Contributor

@ankur22 ankur22 commented Feb 9, 2026

What?

This ensures that all redirected requests are handled for page.on('response') and page.on('requestfinished').

Why?

When working with page.on() if a request was redirected, before this fix, the final redirected request would be handled but all of the redirects before the final one would not be handled.

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

  • I have added the correct milestone and labels to the PR.
  • I have updated the release notes: link
  • I have updated or added an issue to the k6-documentation: grafana/k6-docs#NUMBER if applicable
  • I have updated or added an issue to the TypeScript definitions: grafana/k6-DefinitelyTyped#NUMBER if applicable

Related PR(s)/Issue(s)

When working with page.on() if a request was redirected, before this
fix, the final redirected request would be handled but all of the
middle redirects would not be handled.
@ankur22 ankur22 temporarily deployed to azure-trusted-signing February 9, 2026 21:54 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing February 9, 2026 21:56 — with GitHub Actions Inactive
@ankur22 ankur22 added this to the v1.7.0 milestone Feb 10, 2026
@ankur22 ankur22 marked this pull request as ready for review February 10, 2026 09:45
@ankur22 ankur22 requested a review from a team as a code owner February 10, 2026 09:45
@ankur22 ankur22 requested review from joanlopez and mstoykov and removed request for a team February 10, 2026 09:45
Copy link
Contributor

@joanlopez joanlopez left a comment

Choose a reason for hiding this comment

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

The PR looks great, but I think it would be nice to add a test equivalent to TestPageOnRequestFinishedRedirect but for page.on(response).

What do you think? @ankur22

ankur22 and others added 2 commits February 10, 2026 13:36
Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com>
Test page.on(response) to ensure it works for redirects.
@ankur22
Copy link
Contributor Author

ankur22 commented Feb 10, 2026

The PR looks great, but I think it would be nice to add a test equivalent to TestPageOnRequestFinishedRedirect but for page.on(response).

🤦 missed that. Thanks. Added it in b8e4f7e

@ankur22 ankur22 requested a review from joanlopez February 10, 2026 13:38
@ankur22 ankur22 temporarily deployed to azure-trusted-signing February 10, 2026 13:44 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing February 10, 2026 13:46 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants