Skip to content

Commit

Permalink
Add closing signal if it's missing
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Mar 14, 2023
1 parent 044b870 commit 8ce67c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/internal/fetchSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ async function* parseMultipartChunks(response: Response, contentType: string) {
let buffer = '';
let isPreamble = true;
let boundaryIndex: number;
let payload: any;

chunks: for await (const chunk of streamBody(response)) {
buffer += chunk;
Expand All @@ -43,7 +44,6 @@ async function* parseMultipartChunks(response: Response, contentType: string) {
buffer.indexOf('\r\n\r\n') + 4,
boundaryIndex
);
let payload: any;
try {
yield (payload = JSON.parse(chunk));
} catch (_error) {}
Expand All @@ -54,6 +54,8 @@ async function* parseMultipartChunks(response: Response, contentType: string) {
}
}
}

if (payload && payload.hasNext) yield { hasNext: false };
}

async function* fetchOperation(
Expand Down

0 comments on commit 8ce67c3

Please sign in to comment.