Skip to content

feat(redirect): allow custom redirects to access response headers - #916

Merged
0x676e67 merged 2 commits into
mainfrom
redirect
Aug 30, 2025
Merged

feat(redirect): allow custom redirects to access response headers#916
0x676e67 merged 2 commits into
mainfrom
redirect

Conversation

@0x676e67

Copy link
Copy Markdown
Owner

No description provided.

@0x676e67
0x676e67 marked this pull request as ready for review August 30, 2025 11:53
@0x676e67
0x676e67 requested a review from Copilot August 30, 2025 11:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds the ability for custom redirect policies to access response headers from redirect attempts. The main purpose is to allow developers to make more informed decisions during redirects by examining headers such as cache-control, set-cookie, or custom headers from the redirect response.

  • Added headers field to the Attempt struct in both redirect modules
  • Updated all redirect policy interfaces to pass and expose headers
  • Refactored code organization by moving helper functions and adding const qualifiers

Reviewed Changes

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

File Description
src/redirect.rs Added headers field to Attempt struct, updated Policy check method signature, and reorganized helper functions
src/client/layer/redirect/policy.rs Added headers field and accessor method to policy Attempt struct
src/client/layer/redirect/future.rs Updated Attempt construction to include response headers
examples/request_with_redirect.rs Updated example to demonstrate accessing headers in custom redirect policy

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/redirect.rs Outdated
Comment thread src/redirect.rs
@0x676e67
0x676e67 merged commit 7a1c86a into main Aug 30, 2025
@0x676e67
0x676e67 deleted the redirect branch August 30, 2025 12:07
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