Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/start-server-core/src/request-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,9 @@ export function clearSession(config: Partial<SessionConfig>): Promise<void> {
return h3_clearSession(event, { name: 'start', ...config })
}

// not public API
export function getResponse() {
const event = getH3Event()
// @ts-expect-error accessing internal symbol
return event[Symbol.for('h3.internal.event.res')]
return event.res
}

// not public API (yet)
Expand Down
16 changes: 8 additions & 8 deletions packages/start-server-core/src/server-functions-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ export const handleServerAction = async ({
return new Response(
nonStreamingBody ? JSON.stringify(nonStreamingBody) : undefined,
{
status: response?.status,
statusText: response?.statusText,
status: response.status,
statusText: response.statusText,
headers: {
'Content-Type': 'application/json',
[X_TSS_SERIALIZED]: 'true',
Expand Down Expand Up @@ -252,8 +252,8 @@ export const handleServerAction = async ({
},
})
return new Response(stream, {
status: response?.status,
statusText: response?.statusText,
status: response.status,
statusText: response.statusText,
headers: {
'Content-Type': 'application/x-ndjson',
[X_TSS_SERIALIZED]: 'true',
Expand All @@ -262,8 +262,8 @@ export const handleServerAction = async ({
}

return new Response(undefined, {
status: response?.status,
statusText: response?.statusText,
status: response.status,
statusText: response.statusText,
})
} catch (error: any) {
if (error instanceof Response) {
Expand Down Expand Up @@ -302,8 +302,8 @@ export const handleServerAction = async ({
)
const response = getResponse()
return new Response(serializedError, {
status: response?.status ?? 500,
statusText: response?.statusText,
status: response.status ?? 500,
statusText: response.statusText,
headers: {
'Content-Type': 'application/json',
[X_TSS_SERIALIZED]: 'true',
Expand Down
Loading