Fake Mirrors
    Preparing search index...

    Class HttpBodyWrap

    Wrapper class for HTTP message bodies.

    formatQueryStringOptions: FormatQueryStringOptions = {}

    Custom options for formatting query strings.

    parseQueryStringOptions: ParseQueryStringOptions = {}

    Custom options for parsing query strings.

    • get isFrozen(): boolean

      Checks if the wrapper is frozen (read-only).

      Returns boolean

      true if the wrapper is frozen, false otherwise.

    • Gets the body as a Base64 string (cached).

      Returns string

      The Base64 encoded body.

      Error If Base64 encoding fails.

    • Gets the body as a JSON object (cached).

      Parameters

      • Optionalcharset: string

        The optional character encoding.

      Returns HttpJson

      The parsed JSON object.

      Error If decoding or JSON parsing fails.

    • Gets the body as a text string (cached).

      Parameters

      • charset: string = 'utf8'

        The character encoding, default: 'utf8'.

      Returns string

      The decoded text.

      Error If decoding fails.

    • Clears the body and resets all caches.

      Returns this

      This wrapper for method chaining.

      Error If the wrapper is frozen.

    • Sets the body from a Base64 string.

      Parameters

      • base64: string

        The Base64 encoded string.

      Returns this

      This wrapper for method chaining.

      Error If the wrapper is frozen.

      Error If Base64 decoding fails.

    • Sets the body from a JSON object.

      Parameters

      • json: HttpJson

        The JSON object to stringify.

      • Optionalcharset: string

        The optional character encoding.

      Returns this

      This wrapper for method chaining.

      Error If the wrapper is frozen.

      Error If JSON stringification or encoding fails.

    • Sets the body from a query string object.

      Parameters

      • queryString: HttpQueryString

        The query string object.

      • Optionalcharset: string

        The optional character encoding.

      Returns this

      This wrapper for method chaining.

      Error If the wrapper is frozen.

      Error If formatting fails.

    • Sets the body from a text string.

      Parameters

      • text: string

        The text to set as the body.

      • charset: string = 'utf8'

        The character encoding, default: 'utf8'.

      Returns this

      This wrapper for method chaining.

      Error If the wrapper is frozen.

      Error If encoding fails.