unjs / ofetch

😱 A better fetch API. Works on node, browser and workers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error on Response.blob()

Dominic-Marcelino opened this issue · comments

Environment

  • Operating System: Darwin
  • Node Version: v18.19.1
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: pnpm@8.15.4

Reproduction

https://stackblitz.com/edit/github-xzcnqt?file=app.vue,nuxt.config.ts

Describe the bug

When using Nuxts $fetch (-->ofetch) instead of the native fetch Response.blob() creates an error:
TypeError: r2.blob is not a function

Additional context

Originally opened Nuxt Issue: nuxt/nuxt#26843

For reference the function of the directus sdk which is used in the demo:
https://github.com/directus/directus/blob/d37a16a31ebd201ef884bf30994366b95b156458/sdk/src/rest/commands/read/assets.ts#L33-L44

NOTE: The function readAssetArrayBuffer (directy below) which does the same for arrayBuffers works as expected. Therewith I assume it's something about blobs.

Logs

No response