Skip to content

Commit f279845

Browse files
committed
Add new header
1 parent 3b184d3 commit f279845

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ export async function handleServerFunction(h3Event: H3Event) {
6060
contentType?.startsWith("application/x-www-form-urlencoded")
6161
) {
6262
parsed.push(await event.request.formData());
63-
} else if (contentType?.startsWith('text/plain')) {
63+
} else if (contentType?.startsWith('application/json')) {
64+
parsed = await event.request.json() as any[];
65+
} else if (request.headers.has('x-serialized')) {
6466
parsed = (await deserializeJSONStream(event.request.clone())) as any[];
6567
}
6668
}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// @ts-ignore - seroval exports issue with NodeNext
1+
22
import { type Component } from "solid-js";
33
import {
44
deserializeJSONStream,
55
deserializeJSStream,
6-
serializeToJSONStream,
6+
// serializeToJSONStream,
77
serializeToJSONString,
88
} from "./serialization";
99

@@ -51,7 +51,11 @@ async function fetchServerFunction(
5151
body: await serializeToJSONString(args),
5252
// duplex: 'half',
5353
// body: serializeToJSONStream(args),
54-
headers: { ...options.headers, "Content-Type": "text/plain" },
54+
headers: {
55+
...options.headers,
56+
"x-serialized": "true",
57+
"Content-Type": "text/plain"
58+
},
5559
}));
5660

5761
if (

0 commit comments

Comments
 (0)