Skip to content

feat: support follow_redirect#597

Open
fzipi wants to merge 4 commits intomainfrom
feat/add-follow-redirect
Open

feat: support follow_redirect#597
fzipi wants to merge 4 commits intomainfrom
feat/add-follow-redirect

Conversation

@fzipi
Copy link
Copy Markdown
Member

@fzipi fzipi commented Jan 29, 2026

what

  • implement remaining follow_redirect boolean from schema

why

  • support all schema features

refs

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements the remaining follow_redirect boolean from the test schema to allow stages to follow redirects emitted by prior stages.

Changes:

  • Track the previous stage’s HTTP response in TestRunContext and reset it at the start of each test case.
  • Add redirect parsing/application utilities and wire them into RunStage when follow_redirect is enabled.
  • Add unit tests for redirect parsing and input mutation behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
runner/types.go Adds LastStageResponse to carry prior-stage response state for redirect handling.
runner/run.go Resets/stores LastStageResponse per test/stage and applies follow_redirect logic before sending requests.
runner/redirect.go Implements redirect Location parsing and applies redirect target to the next stage’s request input.
runner/redirect_test.go Adds unit tests for redirect parsing and applying redirects to inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread runner/run.go
Comment thread runner/run.go
Comment thread runner/redirect.go Outdated
Comment thread runner/redirect.go Outdated
Comment thread runner/redirect.go Outdated
Comment thread runner/redirect.go Outdated
Comment thread runner/redirect_test.go
Comment thread runner/run.go
@fzipi
Copy link
Copy Markdown
Member Author

fzipi commented Jan 29, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 29, 2026

@fzipi I've opened a new pull request, #598, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 3 commits January 29, 2026 08:34
)

* Initial plan

* fix: address PR review comments for follow_redirect

- Restrict redirect status codes to 300-303, 307-308 (not all 3xx)
- Use url.Parse + ResolveReference for proper URL handling
- Include port in Host header for non-default ports
- Fix comment about fragments in RequestURI
- Store and use previous stage input for relative redirects
- Move overriddenTestResult check before follow_redirect
- Add zerolog.Disabled to redirect_test.go SetupSuite

Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>

* test: add integration test for follow_redirect

Add integration test that validates:
- Stage 1 sends request to /redirect-me
- Stage 1 receives 302 redirect to /redirected
- Stage 2 uses follow_redirect to follow the redirect
- Stage 2 sends request to /redirected
- Both stages complete successfully

Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>

* test: improve test coverage for follow_redirect

- Add test for non-redirect 3xx codes (304, 305, 306)
- Remove redundant port != 0 check in applyRedirectToInput
- Enhance integration test to validate Host header includes port
- Verify Host header is correctly updated after redirect

Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>

* fix: address PR review feedback for follow_redirect implementation

Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>
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.

Implement missing settings from schema

3 participants