Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface HttpResponse

A response of a HTTP request.

Hierarchy

  • HttpResponse

Index

Properties

code

code: number

The status code.

headers

headers: IncomingHttpHeaders

The response headers.

request

request: ClientRequest

The request context.

response

response: any

The response context.

status

status: string

The status message.

Methods

pipe

  • pipe(target: Writable): Writable
  • Pipes the response body to a target.

    Parameters

    • target: Writable

      The target stream.

    Returns Writable

    this

readBody

  • readBody(): Promise<Buffer>
  • Reads the response body.

    Returns Promise<Buffer>

    The promise with the data.

readJSON

  • readJSON<T>(enc?: string): Promise<T>
  • Reads the body and handles it as JSON object.

    Type parameters

    • T

    Parameters

    • Optional enc: string

    Returns Promise<T>

    The promise with the parsed JSON object.

readString

  • readString(enc?: string): Promise<string>
  • Reads the body and handles it as string.

    Parameters

    • Optional enc: string

    Returns Promise<string>

    The promise with response body as string.

Generated using TypeDoc