Genkit JS API reference
    Preparing search index...

    Class NextResponse<Body>

    This class extends the Web Response API with additional convenience methods.

    Read more: Next.js Docs: NextResponse

    Type Parameters

    • Body = unknown

    Hierarchy

    • Response
      • NextResponse
    Index

    Constructors

    • Type Parameters

      • Body = unknown

      Parameters

      • Optionalbody: BodyInit | null
      • Optionalinit: ResponseInit

      Returns NextResponse<Body>

    Properties

    "[INTERNALS]": { body?: Body; cookies: ResponseCookies; url?: NextURL }
    body: ReadableStream<Uint8Array<ArrayBuffer>> | null
    bodyUsed: boolean
    headers: Headers

    The headers read-only property of the with the response.

    MDN Reference

    ok: boolean

    The ok read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.

    MDN Reference

    redirected: boolean

    The redirected read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.

    MDN Reference

    status: number

    The status read-only property of the Response interface contains the HTTP status codes of the response.

    MDN Reference

    statusText: string

    The statusText read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.

    MDN Reference

    type: ResponseType

    The type read-only property of the Response interface contains the type of the response.

    MDN Reference

    url: string

    The url read-only property of the Response interface contains the URL of the response.

    MDN Reference

    Accessors

    • get cookies(): ResponseCookies

      Returns ResponseCookies

    Methods

    • Returns Promise<ArrayBuffer>

    • Returns Promise<Blob>

    • Returns Promise<Uint8Array<ArrayBuffer>>

    • The clone() method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.

      MDN Reference

      Returns Response

    • Returns Promise<FormData>

    • Returns Promise<any>

    • Returns Promise<string>

    • The error() static method of the Response interface returns a new Response object associated with a network error.

      MDN Reference

      Returns Response

    • The json() static method of the Response interface returns a Response that contains the provided JSON data as body, and a Content-Type header which is set to application/json.

      MDN Reference

      Type Parameters

      • JsonBody

      Parameters

      • body: JsonBody
      • Optionalinit: ResponseInit

      Returns NextResponse<JsonBody>

    • Parameters

      • Optionalinit: MiddlewareResponseInit

      Returns NextResponse<unknown>

    • The redirect() static method of the Response interface returns a Response resulting in a redirect to the specified URL.

      MDN Reference

      Parameters

      • url: string | NextURL | URL
      • Optionalinit: number | ResponseInit

      Returns NextResponse<unknown>

    • Parameters

      • destination: string | NextURL | URL
      • Optionalinit: MiddlewareResponseInit

      Returns NextResponse<unknown>