aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/js/web/fetch/fetch.stream.test.ts47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/js/web/fetch/fetch.stream.test.ts b/test/js/web/fetch/fetch.stream.test.ts
index 5473358d4..fb2bb2699 100644
--- a/test/js/web/fetch/fetch.stream.test.ts
+++ b/test/js/web/fetch/fetch.stream.test.ts
@@ -122,6 +122,53 @@ describe("fetch() with streaming", () => {
}
});
+ it(`should be locked after start buffering when calling getReader`, async () => {
+ let server: Server | null = null;
+ try {
+ server = Bun.serve({
+ port: 0,
+ fetch(req) {
+ return new Response(
+ new ReadableStream({
+ async start(controller) {
+ controller.enqueue("Hello, World!");
+ await Bun.sleep(10);
+ controller.enqueue("Hello, World!");
+ await Bun.sleep(10);
+ controller.enqueue("Hello, World!");
+ await Bun.sleep(10);
+ controller.enqueue("Hello, World!");
+ await Bun.sleep(10);
+ controller.close();
+ },
+ }),
+ {
+ status: 200,
+ headers: {
+ "Content-Type": "text/plain",
+ },
+ },
+ );
+ },
+ });
+
+ const server_url = `http://${server.hostname}:${server.port}`;
+ const res = await fetch(server_url);
+ try {
+ const body = res.body as ReadableStream<Uint8Array>;
+ const promise = res.text(); // start buffering
+ body.getReader(); // get a reader
+ const result = await promise; // should throw the right error
+ expect(result).toBe("unreachable");
+ } catch (err: any) {
+ if (err.name !== "TypeError") throw err;
+ expect(err.message).toBe("ReadableStream is locked");
+ }
+ } finally {
+ server?.stop();
+ }
+ });
+
it("can deflate with and without headers #4478", async () => {
let server: Server | null = null;
try {
p-flag'>warn-exp-flag Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/packages/integrations/prefetch/test/fixtures/basic-prefetch/src/pages (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2022-06-28Revert "chore: remove memory test from ci"Gravatar bholmesdev 1-0/+6
This reverts commit 3f79a6e73fc49dee014df864478aeace41d42e60.
2022-06-28chore: remove memory test from ciGravatar bholmesdev 1-6/+0
2022-06-28[ci] formatGravatar natemoo-re 1-1/+1
2022-06-28chore(lint): fix lint issues (#3743)Gravatar Nate Moore 2-3/+3
Co-authored-by: Nate Moore <nate@astro.build>
2022-06-28[ci] update lockfile (#3740)Gravatar Fred K. Bot 24-71/+71
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-06-28Fix Tailwind integration Typescript warning (#3732)Gravatar Victor 2-1/+6
* Make options optional * chore: add changeset Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
2022-06-27[ci] formatGravatar bholmesdev 2-3/+3
2022-06-27Refactor: remove Deno shim to esbuild "banner" (#3734)Gravatar Ben Holmes 7-15/+22
* refactor: remove Deno shim to esbuild "banner" * refactor: move shim to const * refactor: add shim to netlify edge * chore: changeset
2022-06-27[ci] formatGravatar FredKSchott 9-23/+25
2022-06-27update telemetry to support more anonymized project id (#3713)Gravatar Fred K. Schott 20-351/+311
* update telemetry to support more anonymized project id * Create strange-laws-kick.md * respond to nate feedback
2022-06-27SImplify "astro add" by removing confusing multi-select (#3715)Gravatar Fred K. Schott 13-258/+157
* wip * update create-astro for new astro add * update copy * update git prompt * Update packages/astro/src/core/logger/node.ts Co-authored-by: Chris Swithinbank <swithinbank@gmail.com> * Update packages/create-astro/test/install-step.test.js Co-authored-by: Chris Swithinbank <swithinbank@gmail.com> * update git prompt * update test Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>