Mayson Monorepo Documentation
    Preparing search index...

    Interface HttpClientResponse<RawResponseType, StreamType>

    Abstract representation of an HTTP response. This is an experimental interface and is not yet stable.

    interface HttpClientResponse<RawResponseType = any, StreamType = any> {
        getStatusCode(): number;
        getHeaders(): { [key: string]: string };
        getRawResponse(): RawResponseType;
        toStream(streamCompleteCallback: () => void): StreamType;
        toJSON(): Promise<object>;
    }

    Type Parameters

    • RawResponseType = any
    • StreamType = any
    Index

    Methods

    • The numeric HTTP status code for the response.

      Returns number

    • The response headers.

      Returns { [key: string]: string }

    • This returns the underlying raw response object for the client.

      Returns RawResponseType

    • This returns the content as a stream. The expectation is that content will not have been buffered into memory at this point by the client.

      The streamCompleteCallback should be invoked by the response implementation when the stream has been consumed.

      Parameters

      • streamCompleteCallback: () => void

      Returns StreamType

    • Converts the response content into a JSON object, failing if JSON couldn't be parsed.

      Returns Promise<object>