Skip to content

Commit

Permalink
Add missing reader.cancel call
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Mar 14, 2023
1 parent bc8b587 commit eedc540
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/core/src/internal/fetchSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ async function* streamBody(response: Response): AsyncIterableIterator<string> {
} else {
const reader = response.body!.getReader();
let result: ReadableStreamReadResult<ChunkData>;
while (!(result = await reader.read()).done) yield toString(result.value);
try {
while (!(result = await reader.read()).done) yield toString(result.value);
} finally {
reader.cancel();
}
}
}

Expand Down

0 comments on commit eedc540

Please sign in to comment.