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: allow custom global options for $fetch.create #401

Merged
merged 5 commits into from
Aug 27, 2024
Merged

Conversation

CafuChino
Copy link
Contributor

πŸ”— Linked issue

#71

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This commit adds an optional parameter globalOptionsOverwrite to $fetch.create.

However, for HTTP, headers are not case-sensitive. But for some reason, headers are case-sensitive in some old backend frameworks. This optional parameter overrides native Headers behaviour in such situations.

As only adding an optional parameter, it won`t break anything, maybe?

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pi0 pi0 changed the title feat: allow global options overeriting in $fetch.create feat: allow custom global options for $fetch.create Aug 27, 2024
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 67.22%. Comparing base (27996d3) to head (8ff591b).
Report is 36 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #401       +/-   ##
===========================================
+ Coverage   56.86%   67.22%   +10.35%     
===========================================
  Files          16       16               
  Lines         728      476      -252     
  Branches      113      116        +3     
===========================================
- Hits          414      320       -94     
+ Misses        303      146      -157     
+ Partials       11       10        -1     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

LGTM. Although modifying standard globals should be last resort, there are legitimate usecases and it is better than patching actual globals

@pi0 pi0 merged commit 7030ad9 into unjs:main Aug 27, 2024
6 checks passed
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