Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Response

Represents an outgoing response.

Hierarchy

  • Response

Index

Properties

Optional body

body: string | Buffer

The response body as a string or a Buffer

end

end: (body?: string | Buffer) => void

Sends the response

Type declaration

    • (body?: string | Buffer): void
    • Parameters

      • Optional body: string | Buffer

      Returns void

getHeader

getHeader: (name: string) => string | string[]

Gets the value of a header

param

The name of the header to return

returns

The value of the header

Type declaration

    • (name: string): string | string[]
    • Parameters

      • name: string

      Returns string | string[]

getHeaders

getHeaders: () => {}

Gets all headers as key/value pairs.

Type declaration

    • (): {}
    • Returns {}

      • [name: string]: string[]

removeHeader

removeHeader: (name: string) => void

Removes a header

param

The header to remove

Type declaration

    • (name: string): void
    • Parameters

      • name: string

      Returns void

setHeader

setHeader: (name: string, value: any) => void

Sets a header

param

The name of the header to set

param

The value to set

Type declaration

    • (name: string, value: any): void
    • Parameters

      • name: string
      • value: any

      Returns void

Optional statusCode

statusCode: undefined | number

The HTTP status code

Optional statusMessage

statusMessage: undefined | string

The HTTP status message

writeHead

writeHead: (statusCode: number, statusMessageOrHeaders?: Headers | string, headers?: Headers) => void

Writes the response header

param

The HTTP status code

param

Response headers to send.

Type declaration

    • (statusCode: number, statusMessageOrHeaders?: Headers | string, headers?: Headers): void
    • Parameters

      • statusCode: number
      • Optional statusMessageOrHeaders: Headers | string
      • Optional headers: Headers

      Returns void

Generated using TypeDoc