getJsonServerHandler() — astro Function Reference
Architecture documentation for the getJsonServerHandler() function in server.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 24188646_08f2_55ed_5b29_0b515184121a["getJsonServerHandler()"] 12df90c3_b0fe_d858_b821_5011b6067fdb["server.ts"] 24188646_08f2_55ed_5b29_0b515184121a -->|defined in| 12df90c3_b0fe_d858_b821_5011b6067fdb 246d72b2_472d_5097_3c81_0588c08ec2c9["defineAction()"] 246d72b2_472d_5097_3c81_0588c08ec2c9 -->|calls| 24188646_08f2_55ed_5b29_0b515184121a style 24188646_08f2_55ed_5b29_0b515184121a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/actions/runtime/server.ts lines 107–126
function getJsonServerHandler<TOutput, TInputSchema extends z.$ZodType>(
handler: ActionHandler<TInputSchema, TOutput>,
inputSchema?: TInputSchema,
) {
return async (unparsedInput: unknown, context: ActionAPIContext): Promise<Awaited<TOutput>> => {
if (unparsedInput instanceof FormData) {
throw new ActionError({
code: 'UNSUPPORTED_MEDIA_TYPE',
message: 'This action only accepts JSON.',
});
}
if (!inputSchema) return await handler(unparsedInput, context);
const parsed = await z.safeParseAsync(inputSchema, unparsedInput);
if (!parsed.success) {
throw new ActionInputError(parsed.error.issues);
}
return await handler(parsed.data, context);
};
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does getJsonServerHandler() do?
getJsonServerHandler() is a function in the astro codebase, defined in packages/astro/src/actions/runtime/server.ts.
Where is getJsonServerHandler() defined?
getJsonServerHandler() is defined in packages/astro/src/actions/runtime/server.ts at line 107.
What calls getJsonServerHandler()?
getJsonServerHandler() is called by 1 function(s): defineAction.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free