Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HttpResponse

Hierarchy

  • ServerResponse
    • HttpResponse

Implements

  • WritableStream

Index

Constructors

constructor

  • Parameters

    • req: IncomingMessage

    Returns HttpResponse

Properties

chunkedEncoding

chunkedEncoding: boolean

connection

connection: Socket
deprecate

Use socket instead.

destroyed

destroyed: boolean

finished

finished: boolean
deprecated

Use writableEnded instead.

headersSent

headersSent: boolean

sendDate

sendDate: boolean

shouldKeepAlive

shouldKeepAlive: boolean

socket

socket: Socket

statusCode

statusCode: number

statusMessage

statusMessage: string

upgrading

upgrading: boolean

useChunkedEncodingByDefault

useChunkedEncodingByDefault: boolean

Readonly writable

writable: boolean

Readonly writableCorked

writableCorked: number

Readonly writableEnded

writableEnded: boolean

Readonly writableFinished

writableFinished: boolean

Readonly writableHighWaterMark

writableHighWaterMark: number

Readonly writableLength

writableLength: number

Readonly writableObjectMode

writableObjectMode: boolean

Static mimeLookupCache

mimeLookupCache: Map<string, string | false> = new Map<string, string | false>()

Accessors

contentType

  • get contentType(): string
  • set contentType(value: string | MimeTypes): void
  • Returns string

  • Parameters

    Returns void

etag

  • get etag(): string | undefined
  • set etag(value: undefined | string): void
  • Returns string | undefined

  • Parameters

    • value: undefined | string

    Returns void

lastModified

  • get lastModified(): Date | string | undefined
  • set lastModified(date: Date | string | undefined): void
  • Returns Date | string | undefined

  • Parameters

    • date: Date | string | undefined

    Returns void

status

  • Returns HttpStatus

  • Parameters

    Returns void

Methods

_destroy

  • _destroy(error: Error | null, callback: (error?: Error | null) => void): void
  • Parameters

    • error: Error | null
    • callback: (error?: Error | null) => void
        • (error?: Error | null): void
        • Parameters

          • Optional error: Error | null

          Returns void

    Returns void

_final

  • _final(callback: (error?: Error | null) => void): void
  • Parameters

    • callback: (error?: Error | null) => void
        • (error?: Error | null): void
        • Parameters

          • Optional error: Error | null

          Returns void

    Returns void

_write

  • _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void
  • Parameters

    • chunk: any
    • encoding: string
    • callback: (error?: Error | null) => void
        • (error?: Error | null): void
        • Parameters

          • Optional error: Error | null

          Returns void

    Returns void

Optional _writev

  • _writev(chunks: Array<{ chunk: any; encoding: string }>, callback: (error?: Error | null) => void): void
  • Parameters

    • chunks: Array<{ chunk: any; encoding: string }>
    • callback: (error?: Error | null) => void
        • (error?: Error | null): void
        • Parameters

          • Optional error: Error | null

          Returns void

    Returns void

addListener

  • addListener(event: "close", listener: () => void): this
  • addListener(event: "drain", listener: () => void): this
  • addListener(event: "error", listener: (err: Error) => void): this
  • addListener(event: "finish", listener: () => void): this
  • addListener(event: "pipe", listener: (src: Readable) => void): this
  • addListener(event: "unpipe", listener: (src: Readable) => void): this
  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Event emitter The defined events on documents including:

    1. close
    2. drain
    3. error
    4. finish
    5. pipe
    6. unpipe

    Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • Parameters

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: (src: Readable) => void
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: (src: Readable) => void
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

addTrailers

  • addTrailers(headers: OutgoingHttpHeaders | Array<[string, string]>): void
  • Parameters

    • headers: OutgoingHttpHeaders | Array<[string, string]>

    Returns void

assignSocket

  • assignSocket(socket: Socket): void
  • Parameters

    • socket: Socket

    Returns void

attachment

  • attachment(filename?: undefined | string, options?: Options): this
  • Parameters

    • Optional filename: undefined | string
    • Optional options: Options

    Returns this

cork

  • cork(): void
  • Returns void

destroy

  • destroy(error?: Error): void
  • Parameters

    Returns void

detachSocket

  • detachSocket(socket: Socket): void
  • Parameters

    • socket: Socket

    Returns void

emit

  • emit(event: "close"): boolean
  • emit(event: "drain"): boolean
  • emit(event: "error", err: Error): boolean
  • emit(event: "finish"): boolean
  • emit(event: "pipe", src: Readable): boolean
  • emit(event: "unpipe", src: Readable): boolean
  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: "close"

    Returns boolean

  • Parameters

    • event: "drain"

    Returns boolean

  • Parameters

    • event: "error"
    • err: Error

    Returns boolean

  • Parameters

    • event: "finish"

    Returns boolean

  • Parameters

    • event: "pipe"
    • src: Readable

    Returns boolean

  • Parameters

    • event: "unpipe"
    • src: Readable

    Returns boolean

  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

end

  • end(cb?: undefined | (() => void)): void
  • end(chunk: any, cb?: undefined | (() => void)): void
  • end(chunk: any, encoding: string, cb?: undefined | (() => void)): void
  • Parameters

    • Optional cb: undefined | (() => void)

    Returns void

  • Parameters

    • chunk: any
    • Optional cb: undefined | (() => void)

    Returns void

  • Parameters

    • chunk: any
    • encoding: string
    • Optional cb: undefined | (() => void)

    Returns void

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

flushHeaders

  • flushHeaders(): void

getHeader

  • getHeader(name: string): number | string | string[] | undefined
  • Parameters

    • name: string

    Returns number | string | string[] | undefined

getHeaderNames

  • getHeaderNames(): string[]

getHeaders

  • getHeaders(): OutgoingHttpHeaders
  • Returns OutgoingHttpHeaders

getMaxListeners

  • getMaxListeners(): number

hasHeader

  • hasHeader(name: string): boolean
  • Parameters

    • name: string

    Returns boolean

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: "close", listener: () => void): this
  • on(event: "drain", listener: () => void): this
  • on(event: "error", listener: (err: Error) => void): this
  • on(event: "finish", listener: () => void): this
  • on(event: "pipe", listener: (src: Readable) => void): this
  • on(event: "unpipe", listener: (src: Readable) => void): this
  • on(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • Parameters

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: (src: Readable) => void
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: (src: Readable) => void
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: "close", listener: () => void): this
  • once(event: "drain", listener: () => void): this
  • once(event: "error", listener: (err: Error) => void): this
  • once(event: "finish", listener: () => void): this
  • once(event: "pipe", listener: (src: Readable) => void): this
  • once(event: "unpipe", listener: (src: Readable) => void): this
  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • Parameters

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: (src: Readable) => void
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: (src: Readable) => void
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

pipe

  • pipe<T>(destination: T, options?: undefined | { end?: undefined | false | true }): T
  • Type parameters

    • T: WritableStream

    Parameters

    • destination: T
    • Optional options: undefined | { end?: undefined | false | true }

    Returns T

prependListener

  • prependListener(event: "close", listener: () => void): this
  • prependListener(event: "drain", listener: () => void): this
  • prependListener(event: "error", listener: (err: Error) => void): this
  • prependListener(event: "finish", listener: () => void): this
  • prependListener(event: "pipe", listener: (src: Readable) => void): this
  • prependListener(event: "unpipe", listener: (src: Readable) => void): this
  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • Parameters

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: (src: Readable) => void
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: (src: Readable) => void
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: "close", listener: () => void): this
  • prependOnceListener(event: "drain", listener: () => void): this
  • prependOnceListener(event: "error", listener: (err: Error) => void): this
  • prependOnceListener(event: "finish", listener: () => void): this
  • prependOnceListener(event: "pipe", listener: (src: Readable) => void): this
  • prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this
  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • Parameters

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: (src: Readable) => void
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: (src: Readable) => void
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeHeader

  • removeHeader(name: string): void
  • Parameters

    • name: string

    Returns void

removeListener

  • removeListener(event: "close", listener: () => void): this
  • removeListener(event: "drain", listener: () => void): this
  • removeListener(event: "error", listener: (err: Error) => void): this
  • removeListener(event: "finish", listener: () => void): this
  • removeListener(event: "pipe", listener: (src: Readable) => void): this
  • removeListener(event: "unpipe", listener: (src: Readable) => void): this
  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this

setDefaultEncoding

  • setDefaultEncoding(encoding: string): this

setHeader

  • setHeader(name: string, value: number | string | string[]): void
  • Parameters

    • name: string
    • value: number | string | string[]

    Returns void

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setTimeout

  • setTimeout(msecs: number, callback?: undefined | (() => void)): this
  • Parameters

    • msecs: number
    • Optional callback: undefined | (() => void)

    Returns this

uncork

  • uncork(): void
  • Returns void

write

  • write(chunk: any, cb?: undefined | ((error: Error | null | undefined) => void)): boolean
  • write(chunk: any, encoding: string, cb?: undefined | ((error: Error | null | undefined) => void)): boolean
  • Parameters

    • chunk: any
    • Optional cb: undefined | ((error: Error | null | undefined) => void)

    Returns boolean

  • Parameters

    • chunk: any
    • encoding: string
    • Optional cb: undefined | ((error: Error | null | undefined) => void)

    Returns boolean

writeContinue

  • writeContinue(callback?: undefined | (() => void)): void
  • Parameters

    • Optional callback: undefined | (() => void)

    Returns void

writeHead

  • writeHead(statusCode: number, reasonPhrase?: undefined | string, headers?: OutgoingHttpHeaders): this
  • writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this
  • Parameters

    • statusCode: number
    • Optional reasonPhrase: undefined | string
    • Optional headers: OutgoingHttpHeaders

    Returns this

  • Parameters

    • statusCode: number
    • Optional headers: OutgoingHttpHeaders

    Returns this

writeProcessing

  • writeProcessing(): void

Static getMimeType

  • getMimeType(type: string): string | false
  • Parameters

    • type: string

    Returns string | false

Generated using TypeDoc