feat: allow custom global options for `$fetch.create` by CafuChino · Pull Request #401 · unjs/ofetch · GitHub
Skip to content

feat: allow custom global options for $fetch.create#401

Merged
pi0 merged 5 commits into
unjs:mainfrom
CafuChino:main
Aug 27, 2024
Merged

feat: allow custom global options for $fetch.create#401
pi0 merged 5 commits into
unjs:mainfrom
CafuChino:main

Conversation

@CafuChino

Copy link
Copy Markdown
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
@codecov

codecov Bot commented Aug 27, 2024

Copy link
Copy Markdown

@pi0 pi0 left a comment

Copy link
Copy Markdown
Member

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
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