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

Read more: Next.js Docs: NextRequest

Hierarchy (view full)

Constructors

Properties

[INTERNALS]: {
    cookies: RequestCookies;
    geo: undefined | {
        city?: string;
        country?: string;
        latitude?: string;
        longitude?: string;
        region?: string;
    };
    ip?: string;
    nextUrl: NextURL;
    url: string;
}

Type declaration

  • cookies: RequestCookies
  • geo: undefined | {
        city?: string;
        country?: string;
        latitude?: string;
        longitude?: string;
        region?: string;
    }
  • Optional ip?: string
  • nextUrl: NextURL
  • url: string
arrayBuffer: (() => Promise<ArrayBuffer>)

Type declaration

    • (): Promise<ArrayBuffer>
    • Returns Promise<ArrayBuffer>

blob: (() => Promise<Blob>)

Type declaration

body: null | ReadableStream<any>
bodyUsed: boolean
clone: (() => Request)

Type declaration

credentials: RequestCredentials
destination: RequestDestination
duplex: "half"
formData: (() => Promise<FormData>)

Type declaration

    • (): Promise<FormData>
    • Returns Promise<FormData>

      Deprecated

      This method is not recommended for parsing multipart/form-data bodies in server environments. It is recommended to use a library such as @fastify/busboy as follows:

      Example

      import { Busboy } from '@fastify/busboy'
      import { Readable } from 'node:stream'

      const response = await fetch('...')
      const busboy = new Busboy({ headers: { 'content-type': response.headers.get('content-type') } })

      // handle events emitted from `busboy`

      Readable.fromWeb(response.body).pipe(busboy)

Deprecated

This method is not recommended for parsing multipart/form-data bodies in server environments. It is recommended to use a library such as @fastify/busboy as follows:

Example

import { Busboy } from '@fastify/busboy'
import { Readable } from 'node:stream'

const response = await fetch('...')
const busboy = new Busboy({ headers: { 'content-type': response.headers.get('content-type') } })

// handle events emitted from `busboy`

Readable.fromWeb(response.body).pipe(busboy)
headers: Headers
integrity: string
json: (() => Promise<unknown>)

Type declaration

    • (): Promise<unknown>
    • Returns Promise<unknown>

keepalive: boolean
method: string
redirect: RequestRedirect
referrer: string
referrerPolicy: ReferrerPolicy
signal: AbortSignal
text: (() => Promise<string>)

Type declaration

    • (): Promise<string>
    • Returns Promise<string>

Accessors

  • get geo(): undefined | {
        city?: string;
        country?: string;
        latitude?: string;
        longitude?: string;
        region?: string;
    }
  • Returns undefined | {
        city?: string;
        country?: string;
        latitude?: string;
        longitude?: string;
        region?: string;
    }

  • get ip(): undefined | string
  • Returns undefined | string

  • get url(): string
  • Returns string