Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ServerResponse

Hierarchy

Implements

  • WritableStream

Index

Constructors

constructor

Properties

chunkedEncoding

chunkedEncoding: boolean

connection

connection: Socket

finished

finished: boolean

headersSent

headersSent: boolean

sendDate

sendDate: boolean

shouldKeepAlive

shouldKeepAlive: boolean

statusCode

statusCode: number

statusMessage

statusMessage: string

upgrading

upgrading: boolean

useChunkedEncodingByDefault

useChunkedEncodingByDefault: boolean

writable

writable: boolean

writableFinished

writableFinished: boolean

writableHighWaterMark

writableHighWaterMark: number

writableLength

writableLength: number

Static defaultMaxListeners

defaultMaxListeners: number

Methods

_destroy

  • _destroy(error: Error | null, callback: function): void
  • Parameters

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

          • Optional error: Error | null

          Returns void

    Returns void

_final

  • _final(callback: function): void
  • Parameters

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

          • Optional error: Error | null

          Returns void

    Returns void

_write

  • _write(chunk: any, encoding: string, callback: function): void
  • Parameters

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

          • Optional error: Error | null

          Returns void

    Returns void

Optional _writev

  • _writev(chunks: Array<object>, callback: function): void
  • Parameters

    • chunks: Array<object>
    • callback: function
        • (error?: Error | null): void
        • Parameters

          • Optional error: Error | null

          Returns void

    Returns void

addListener

  • addListener(event: "close", listener: function): this
  • addListener(event: "drain", listener: function): this
  • addListener(event: "error", listener: function): this
  • addListener(event: "finish", listener: function): this
  • addListener(event: "pipe", listener: function): this
  • addListener(event: "unpipe", listener: function): this
  • addListener(event: string | symbol, listener: function): 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: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

addTrailers

assignSocket

  • assignSocket(socket: Socket): void
  • Parameters

    Returns void

cork

  • cork(): void
  • Returns void

destroy

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

    • Optional error: Error

    Returns void

detachSocket

  • detachSocket(socket: Socket): void
  • Parameters

    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?: function): void
  • end(chunk: any, cb?: function): void
  • end(chunk: any, encoding: string, cb?: function): void
  • Parameters

    • Optional cb: function
        • (): void
        • Returns void

    Returns void

  • Parameters

    • chunk: any
    • Optional cb: function
        • (): void
        • Returns void

    Returns void

  • Parameters

    • chunk: any
    • encoding: string
    • Optional cb: function
        • (): void
        • Returns 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

getMaxListeners

  • getMaxListeners(): number
  • Returns 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: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: "close", listener: function): this
  • on(event: "drain", listener: function): this
  • on(event: "error", listener: function): this
  • on(event: "finish", listener: function): this
  • on(event: "pipe", listener: function): this
  • on(event: "unpipe", listener: function): this
  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: "close", listener: function): this
  • once(event: "drain", listener: function): this
  • once(event: "error", listener: function): this
  • once(event: "finish", listener: function): this
  • once(event: "pipe", listener: function): this
  • once(event: "unpipe", listener: function): this
  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

pipe

  • pipe<T>(destination: T, options?: object): T
  • Type parameters

    • T: WritableStream

    Parameters

    • destination: T
    • Optional options: object
      • Optional end?: boolean

    Returns T

prependListener

  • prependListener(event: "close", listener: function): this
  • prependListener(event: "drain", listener: function): this
  • prependListener(event: "error", listener: function): this
  • prependListener(event: "finish", listener: function): this
  • prependListener(event: "pipe", listener: function): this
  • prependListener(event: "unpipe", listener: function): this
  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: "close", listener: function): this
  • prependOnceListener(event: "drain", listener: function): this
  • prependOnceListener(event: "error", listener: function): this
  • prependOnceListener(event: "finish", listener: function): this
  • prependOnceListener(event: "pipe", listener: function): this
  • prependOnceListener(event: "unpipe", listener: function): this
  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: function
        • (...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

removeListener

  • removeListener(event: "close", listener: function): this
  • removeListener(event: "drain", listener: function): this
  • removeListener(event: "error", listener: function): this
  • removeListener(event: "finish", listener: function): this
  • removeListener(event: "pipe", listener: function): this
  • removeListener(event: "unpipe", listener: function): this
  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

setDefaultEncoding

  • setDefaultEncoding(encoding: string): this
  • Parameters

    • encoding: string

    Returns 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?: function): this
  • Parameters

    • msecs: number
    • Optional callback: function
        • (): void
        • Returns void

    Returns this

uncork

  • uncork(): void
  • Returns void

write

  • write(chunk: any, cb?: function): boolean
  • write(chunk: any, encoding: string, cb?: function): boolean
  • Parameters

    • chunk: any
    • Optional cb: function
        • (error: Error | null | undefined): void
        • Parameters

          • error: Error | null | undefined

          Returns void

    Returns boolean

  • Parameters

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

          • error: Error | null | undefined

          Returns void

    Returns boolean

writeContinue

  • writeContinue(callback?: function): void
  • Parameters

    • Optional callback: function
        • (): void
        • Returns void

    Returns void

writeHead

  • Parameters

    Returns this

  • Parameters

    Returns this

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc