Skip to content

Commit a56ba83

Browse files
lxsmnsycatilafassina
authored andcommitted
Fix error
1 parent c4c02ba commit a56ba83

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

packages/start/src/server/server-functions-shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,5 @@ export async function extractBody(instance: string, client: boolean, source: Req
112112
return await clone.bytes();
113113
}
114114

115-
throw new Error("Unknown body format");
115+
return undefined;
116116
}

packages/start/src/server/server-runtime.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,14 @@ async function fetchServerFunction(
8484
) {
8585
if (response.body) {
8686
/* @ts-ignore-next-line */
87-
response.customBody = () => {
88-
if (import.meta.env.SEROVAL_MODE === "js") {
89-
return deserializeJSStream(instance, response.clone());
90-
}
91-
return deserializeJSONStream(response.clone());
87+
response.customBody = async () => {
88+
return await extractBody(instance, true, response.clone())
9289
};
9390
}
9491
return response;
9592
}
9693

97-
const clone = response.clone();
98-
const result = await extractBody(instance, true, clone);
94+
const result = await extractBody(instance, true, response.clone());
9995
if (response.headers.has("X-Error")) {
10096
throw result;
10197
}

0 commit comments

Comments
 (0)