unjs / unjs/ofetch

`Body has already been consumed.` with `$fetch.raw`

Open
#101 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
TypeScript
Stars
5.4k
Forks
195
PR merge metrics
No merged PRs in 30d

Description

const resp = await $fetch.raw("https://test.com/blob");
console.log(resp.blob()); // caused error

get Failed to execute 'blob' on 'Response': body stream already read

still can get data by resp._data

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the TypeScript example with $fetch.raw and resp.blob(), then trace how the raw response and _data are handled; done means resp.blob() no longer fails with a body-stream-already-read error while the reported data remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.