Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1.19 KB

endpoint-did-not-return-aresponse.mdx

File metadata and controls

34 lines (24 loc) · 1.19 KB
title The endpoint did not return a Response.
i18nReady true
githubURL https://github.com/withastro/astro/blob/main/packages/runtime/src/internal/core/errors/errors-data.ts

import DontEditWarning from '~/components/DontEditWarning.astro'

EndpointDidNotReturnAResponse: An endpoint must return either a Response, or a Promise that resolves with a Response.

What went wrong?

Thrown when an endpoint does not return anything or returns an object that is not a Response object.

An endpoint must return either a Response, or a Promise that resolves with a Response. For example:

import type { APIContext } from 'astro';

export async function GET({ request, url, cookies }: APIContext): Promise<Response> {
    return Response.json({
        success: true,
        result: 'Data from Astro Endpoint!'
    })
}