Open pi0 opened 1 month ago
It's very good idea especially useful for testing API's
Hi @pi0
What's the difference between this and ofetch.create
?
@guyaumetremblay ofetch.create creates instance with immutable defaults. this version has mutable state (and most importantly working cookies, just like a browser tab)
Describe the feature
ofetch
/$fetch
same as native fetch is stateless by-design. This has safety advantages when ofetch is deeply integrated into tools such as Nitro and Nuxt and prevents global side effects and potential header leaks.However, there are also good use cases of having stateful fetch instances:
I think
$fetch.withState()
could be useful.