Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HttpResponse<T>

An HTTP response.

The usual HTTP response attributes are available:

  • {@link HttpResponse#statusCode} the HTTP status code
  • {@link HttpResponse#statusMessage} the HTTP status message
  • {@link HttpResponse#headers} the HTTP headers
  • {@link HttpResponse#version} the HTTP version

The body of the response is returned by {@link HttpResponse#body} decoded as the format specified by the {@link BodyCodec} that built the response.

Keep in mind that using this HttpResponse impose to fully buffer the response body and should be used for payload that can fit in memory.

Type parameters

  • T

Hierarchy

  • HttpResponse

Index

Methods

body

  • body(): T | null
  • Returns T | null

bodyAsBuffer

  • bodyAsBuffer(): Buffer | null
  • Returns Buffer | null

bodyAsJson

  • bodyAsJson<R>(type: any): R | null
  • Type parameters

    • R

    Parameters

    • type: any

    Returns R | null

bodyAsJsonArray

  • bodyAsJsonArray(): any[] | null
  • Returns any[] | null

bodyAsJsonObject

  • bodyAsJsonObject(): {} | null
  • Returns {} | null

bodyAsString

  • bodyAsString(): string | null
  • bodyAsString(encoding: string): string | null
  • Returns string | null

  • Parameters

    • encoding: string

    Returns string | null

cookies

  • cookies(): string
  • Returns string

followedRedirects

  • followedRedirects(): string
  • Returns string

getHeader

  • getHeader(headerName: string): string | null
  • Return the first header value with the specified name

    Parameters

    • headerName: string

    Returns string | null

getTrailer

  • getTrailer(trailerName: string): string | null
  • Return the first trailer value with the specified name

    Parameters

    • trailerName: string

    Returns string | null

headers

  • headers(): MultiMap
  • Returns MultiMap

statusCode

  • statusCode(): number
  • Returns number

statusMessage

  • statusMessage(): string
  • Returns string

trailers

  • trailers(): MultiMap
  • Returns MultiMap

version

  • version(): HttpVersion
  • Returns HttpVersion

Generated using TypeDoc