Skip to main content

TagData

An http duplex object (see below) with these extra properties:

Hierarchy

Index

Properties

commit

commit: string

cwd

cwd: undefined | string

exists

exists: undefined | boolean

repo

repo: string

req

req: IncomingMessage

A IncomingMessage created by http.Server or http.ClientRequest usually passed as the first parameter to the ‘request’ and ‘response’ events. Implements Readable Stream interface but may not be a decendant thereof.

@see
  • request
  • http.IncomingMessage

res

res: ServerResponse

Created http.server. Passed as the second parameter to the ‘request’ event. The response implements Writable Stream interface but isn’t a descendent thereof.

@see
  • request
  • http.ServerResponse

version

version: string

Accessors

complete

  • get complete(): boolean
  • Returns boolean

connection

  • get connection(): Socket
  • Reference to the underlying socket for the request connection.


    Returns Socket

headers

  • get headers(): IncomingHttpHeaders
  • Request/response headers. Key-value pairs of header names and values. Header names are always lower-case.


    Returns IncomingHttpHeaders

httpVersion

  • get httpVersion(): string
  • Requested HTTP Version sent by the client. Usually either ‘1.0’ or ‘1.1’


    Returns string

httpVersionMajor

  • get httpVersionMajor(): number
  • First integer in the httpVersion string


    Returns number

httpVersionMinor

  • get httpVersionMinor(): number
  • Second integer ni the httpVersion string


    Returns number

method

  • get method(): undefined | string
  • Request method of the incoming request.


    Returns undefined | string

readable

  • get readable(): boolean
  • Is this stream readable.


    Returns boolean

socket

  • get socket(): Socket
  • net.Socket object associated with the connection.


    Returns Socket

statusCode

  • get statusCode(): number
  • set statusCode(val: number): void
  • The HTTP status code. Generally assigned before sending headers for a response to a client.


    Returns number

  • Parameters

    • val: number

    Returns void

statusMessage

  • get statusMessage(): string
  • set statusMessage(val: string): void
  • Controls the status message sent to the client as long as an explicit call to response.writeHead() isn’t made If ignored or the value is undefined, the default message corresponding to the status code will be used.


    Returns string

  • Parameters

    • val: string

    Returns void

trailers

  • get trailers(): Dict<string>
  • Request/response trailer headers. Just like headers except these are only written after the initial response to the client. This object is only populated at the ‘end’ event and only work if a ‘transfer-encoding: chunked’ header is sent in the initial response.


    Returns Dict<string>

url

  • get url(): undefined | string
  • Request URL string.


    Returns undefined | string

writable

  • get writable(): boolean
  • Returns boolean

Methods

accept

  • accept(): void
  • Returns void

cork

  • Buffers written data in memory. This data will be flushed when either the uncork or end methods are called.


    Returns TagData

destroy

  • destroy(): void
  • Returns void

end

  • end(reason?: any): void
  • Parameters

    • optionalreason: any

    Returns void

reject

  • reject(code: number, msg: string): void
  • Parameters

    • code: number
    • msg: string

    Returns void

setHeader

  • setHeader(arg0: string, arg1: string): void
  • Parameters

    • arg0: string
    • arg1: string

    Returns void

uncork

  • Flushes all data buffered since cork() was called.


    Returns TagData

writeHead

  • writeHead(statusCode: number, statusMessage: string, headers: string[]): TagData
  • Sends a response header to the client request. Must only be called one time and before calling response.end().


    Parameters

    • statusCode: number

      3-digit HTTP status code, like 404

    • statusMessage: string

      An optional human readable status message to send with the status code

    • headers: string[]

      An object containing the response headers to send

    Returns TagData