vibethinker-3b-zerogpu / chat-ui /src /lib /server /api /utils /superjsonResponse.ts
Mike0021's picture
Use upstream chat-ui frontend
016ed07 verified
Raw
History Blame Contribute Delete
393 Bytes
import superjson from "superjson";
/**
* Create a JSON response serialized with superjson.
* Matches the wire format of the former Elysia `mapResponse` hook.
*/
export function superjsonResponse(data: unknown, init?: ResponseInit): Response {
return new Response(superjson.stringify(data), {
...init,
headers: {
"Content-Type": "application/json",
...init?.headers,
},
});
}