Spaces:
Paused
Paused
Download src/lib/server/api/utils/superjsonResponse.ts from Mike0021/chat-ui-agent-demo: direct link, hf CLI and curl.
- Browser
- Download file 393 Bytes
-
https://huggingface.co/spaces/Mike0021/chat-ui-agent-demo/resolve/main/src/lib/server/api/utils/superjsonResponse.ts
- Command line
-
hf download hf://spaces/Mike0021/chat-ui-agent-demo/src/lib/server/api/utils/superjsonResponse.ts
-
curl -L -o superjsonResponse.ts https://huggingface.co/spaces/Mike0021/chat-ui-agent-demo/resolve/main/src/lib/server/api/utils/superjsonResponse.ts
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, | |
| }, | |
| }); | |
| } | |