unjs / ofetch

๐Ÿ˜ฑ A better fetch API. Works on node, browser and workers.
MIT License
4.01k stars 126 forks source link

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

Closed CafuChino closed 1 month ago

CafuChino commented 3 months ago

๐Ÿ”— Linked issue

71

โ“ Type of 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

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.