Skip to content

IHttpClient

Interface | Source Code

Triggered on a general network error. Does not occur on non-200 series responses.


onReceiveResponse: Event<ReceiveResponseHandler>

Section titled “onReceiveResponse: Event<ReceiveResponseHandler>”

Triggered when a response is received.


Triggered just before a request is sent.


Default options to include in all requests this client makes. Each option should be overrideable if the same option is defined in the provided options when making a request.


A default protocol and domain to use for the instance. It will be prepended to all request URIs if given during construction.

'https://my.site.com/'
'http://my.site.com'

delete(uri: string, requestData?: BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>): Promise<Partial<BasicHttpResponseData>>

Section titled “delete(uri: string, requestData?: BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>): Promise<Partial<BasicHttpResponseData>>”

Convenience function for sending a DELETE request.

A promise that resolves to response data. The properties of the returned object may be undefined if a fetch error occurred during processing. To globally address fetch errors made by this client, use the onFetchError event. To address errors for individual requests, use the allowThrow option on the request and handle it via try/catch.


get(uri: string, requestData?: Omit<BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>, “body”>): Promise<Partial<BasicHttpResponseData>>

Section titled “get(uri: string, requestData?: Omit<BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>, “body”>): Promise<Partial<BasicHttpResponseData>>”

Convenience function for sending a GET request.

A promise that resolves to response data. The properties of the returned object may be undefined if a fetch error occurred during processing. To globally address fetch errors made by this client, use the onFetchError event. To address errors for individual requests, use the allowThrow option on the request and handle it via try/catch.


makeRequest(method: string, uri: string, requestData?: BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>): Promise<Partial<BasicHttpResponseData>>

Section titled “makeRequest(method: string, uri: string, requestData?: BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>): Promise<Partial<BasicHttpResponseData>>”

Perform a request with the specified method. Useful if the convenience functions don’t provide the HTTP verb you need.

A promise that resolves to response data. The properties of the returned object may be undefined if a fetch error occurred during processing. To globally address fetch errors made by this client, use the onFetchError event. To address errors for individual requests, use the allowThrow option on the request and handle it via try/catch.


patch(uri: string, requestData?: BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>): Promise<Partial<BasicHttpResponseData>>

Section titled “patch(uri: string, requestData?: BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>): Promise<Partial<BasicHttpResponseData>>”

Convenience function for sending a PATCH request.

A promise that resolves to response data. The properties of the returned object may be undefined if a fetch error occurred during processing. To globally address fetch errors made by this client, use the onFetchError event. To address errors for individual requests, use the allowThrow option on the request and handle it via try/catch.


post(uri: string, requestData?: BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>): Promise<Partial<BasicHttpResponseData>>

Section titled “post(uri: string, requestData?: BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>): Promise<Partial<BasicHttpResponseData>>”

Convenience function for sending a POST request.

A promise that resolves to response data. The properties of the returned object may be undefined if a fetch error occurred during processing. To globally address fetch errors made by this client, use the onFetchError event. To address errors for individual requests, use the allowThrow option on the request and handle it via try/catch.


put(uri: string, requestData?: BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>): Promise<Partial<BasicHttpResponseData>>

Section titled “put(uri: string, requestData?: BasicHttpRequestData<RawResponseBodyType, ParsedBodyType, HttpRequestOptionsType>): Promise<Partial<BasicHttpResponseData>>”

Convenience function for sending a PUT request.

A promise that resolves to response data. The properties of the returned object may be undefined if a fetch error occurred during processing. To globally address fetch errors made by this client, use the onFetchError event. To address errors for individual requests, use the allowThrow option on the request and handle it via try/catch.