When using ofetch.raw the raw response object cannot be parsed with json method (this works well with ofetch.native) .
The failure happends both on client and server side thus I think it's not related to Node.
Additional context
I'm using @iconify/vue library. It provides setFetch method to use a custom fetch API. I have set fetch.raw in order benefit from the interceptors feature. The response on fetching icons is JSON thus it is parsed with json method.
Logs
### Node
TypeError: Body is unusable
at specConsumeBody (https://rlmilwjxkgithub-cdbi.w-credentialless.staticblitz.com/blitz.6854296d.js:194:73015)
at $.json (https://rlmilwjxkgithub-cdbi.w-credentialless.staticblitz.com/blitz.6854296d.js:194:74238)
at eval (file:///home/projects/rlmilwjxk.github/app.vue:22:74)
at Module.withAsyncContext (file:///home/projects/rlmilwjxk.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:3366:19)
at setup (file:///home/projects/rlmilwjxk.github/app.vue:22:47)
### Browser
TypeError: Failed to execute 'json' on 'Response': body stream already read
Environment
Reproduction
https://stackblitz.com/edit/github-ojv4rk?file=app.vue
Describe the bug
When using
ofetch.raw
the raw response object cannot be parsed withjson
method (this works well withofetch.native
) . The failure happends both on client and server side thus I think it's not related to Node.Additional context
I'm using
@iconify/vue
library. It providessetFetch
method to use a customfetch
API. I have setfetch.raw
in order benefit from the interceptors feature. The response on fetching icons is JSON thus it is parsed withjson
method.Logs