Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface CompletedBody

Hierarchy

  • CompletedBody

Index

Properties

buffer: Buffer

The raw bytes of the response. If a content encoding was used, this is the raw encoded data.

Methods

  • getDecodedBuffer(): Promise<undefined | Buffer>
  • The decoded bytes of the response. If no encoding was used, this is the same as .buffer. The response is decoded and returned asynchronously as a Promise.

    Returns Promise<undefined | Buffer>

  • getFormData(): Promise<undefined | {}>
  • The contents of the response, decoded, and then parsed automatically as either one of the form encoding types (either URL-encoded or multipart), determined automatically from the message content-type header.

    This method is convenient and offers a single mechanism to parse both formats, but you may want to consider parsing on format explicitly with the getUrlEncodedFormData() or getMultipartFormData() methods instead.

    After parsing & decoding, the result is returned asynchronously as a Promise for a key-value(s) object.

    Returns Promise<undefined | {}>

  • getJson(): Promise<undefined | object>
  • The contents of the response, decoded, parsed as UTF-8 string, and then parsed a JSON. The response is decoded and returned asynchronously as a Promise.

    Returns Promise<undefined | object>

  • getMultipartFormData(): Promise<undefined | { data: Buffer; filename?: string; name?: string; type?: string }[]>
  • The contents of the response, decoded, and then parsed as multi-part form data. The response is result is returned asynchronously as a Promise for an array of parts with their names, data and metadata.

    Returns Promise<undefined | { data: Buffer; filename?: string; name?: string; type?: string }[]>

  • getText(): Promise<undefined | string>
  • The contents of the response, decoded and parsed as a UTF-8 string. The response is decoded and returned asynchronously as a Promise.

    Returns Promise<undefined | string>

  • getUrlEncodedFormData(): Promise<undefined | {}>
  • The contents of the response, decoded, parsed as UTF-8 string, and then parsed as URL-encoded form data. After parsing & decoding, the result is returned asynchronously as a Promise for a key-value(s) object.

    Returns Promise<undefined | {}>

Generated using TypeDoc