Skip to content

Commit

Permalink
Merge pull request #1244 from feynmanliang/fix_deserializeStream_larg…
Browse files Browse the repository at this point in the history
…e_values

Support large values in deserializeStream
  • Loading branch information
ryansolid authored Jan 11, 2024
2 parents 3fd7643 + b45966b commit 1daa207
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/start/config/server-runtime.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ async function deserializeStream(id, response) {
}
}

const result = await reader.read();
if (result.done) {
throw new Error("Unexpected end of body");
let serialized = ""
while (true) {
const line = await reader.read();
if (line.done) break;
serialized += new TextDecoder().decode(line.value);
}
const serialized = new TextDecoder().decode(result.value);
let pending = true;
let revived;
const splits = serialized.split("\n");
Expand Down Expand Up @@ -108,7 +109,7 @@ async function fetchServerFunction(base, id, args) {
let result;
if (contentType && contentType.startsWith("text/plain")) {
result = await response.text();
} else if(contentType && contentType.startsWith("application/json")) {
} else if (contentType && contentType.startsWith("application/json")) {
result = await response.json();
} else {
result = deserializeStream(instance, response);
Expand Down

0 comments on commit 1daa207

Please sign in to comment.