Fake Mirrors
    Preparing search index...

    Wrapper for HTTP message body.

    Constructors

    Properties

    formatQueryStringOptions: FormatQueryStringOptions = {}

    Custom options for formatting query strings

    parseQueryStringOptions: ParseQueryStringOptions = {}

    Custom options for parsing query strings

    Accessors

    Methods

    • Get body as JSON object (cached).

      Parameters

      • Optionalcharset: string

        Character encoding (optional)

      Returns HttpJson

      Parsed JSON object

      If Iconv decode fails, or JSON parse fails

    • Get body as text string (cached).

      Parameters

      • charset: string = 'utf8'

        Character encoding (default: 'utf8')

      Returns string

      Decoded text

      If Iconv decode fails

    • Set body from base64 string.

      Parameters

      • base64: string

        Base64 encoded string

      Returns this

      This wrapper for method chaining

      If wrapper is frozen

      If Base64 decode fails

    • Set body from JSON object.

      Parameters

      • json: HttpJson

        JSON object to stringify

      • Optionalcharset: string

        Character encoding (optional)

      Returns this

      This wrapper for method chaining

      If wrapper is frozen

      If JSON stringify fails, or Iconv encode fails

    • Set body from query string object.

      Parameters

      • queryString: HttpQueryString

        Query string object

      • Optionalcharset: string

        Character encoding (optional)

      Returns this

      This wrapper for method chaining

      If wrapper is frozen

      If format query string fails

    • Set body from text string.

      Parameters

      • text: string

        Text to set as body

      • charset: string = 'utf8'

        Character encoding (default: 'utf8')

      Returns this

      This wrapper for method chaining

      If wrapper is frozen

      If Iconv encode fails