Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: always clone and normalize options.headers and options.query #436

Merged
merged 4 commits into from
Aug 28, 2024

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Aug 28, 2024

resolves #393

This PR adds a change to always normalize context.options.headers into a Headers object and making sure it is also cloned.

Additional fixes:

  • If first param to ofetch is a Request, and there is no headers option, it's headers will be used (same as fetch behavior)
  • query and params are now consistent and normalized to the same object.

@pi0 pi0 self-assigned this Aug 28, 2024
@pi0 pi0 merged commit 0d84f7b into main Aug 28, 2024
4 checks passed
@pi0 pi0 deleted the feat/normalizer-headers branch August 28, 2024 11:58
@sondh0127
Copy link

this break the headers assign method. options.header.Authorization. please add breaking-change note

@pi0
Copy link
Member Author

pi0 commented Sep 24, 2024

It is not a breaking change since in < 1.4.0, the type of context.options.headers was HeadersInit | Headers (previous logic in interceptors was supposed to handle all 3 possible values). (added note btw in v1.4.0)

@sondh0127
Copy link

It is not a breaking change since in < 1.4.0, the type of context.options.headers was HeadersInit | Headers (previous logic in interceptors was supposed to handle all 3 possible values). (added note btw in v1.4.0)

thanks for the update.

I didn't realize the header had three possible values

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.

Inconsistent headers object returned after a retried request
2 participants