Skip to content

http

const http: {
get: Promise<HTTPResponse>;
post: Promise<HTTPResponse>;
put: Promise<HTTPResponse>;
patch: Promise<HTTPResponse>;
delete: Promise<HTTPResponse>;
request: (url, options) => Promise<HTTPResponse>;
};

Defined in: domains/http.ts:90

get(url, options?): Promise<HTTPResponse>;

Make a GET request to an external URL.

In the iOS app, requests are proxied through the native layer to bypass CORS. In the browser, standard fetch is used and CORS rules apply.

Parameter Type Description
url string The full URL to request.
options? HTTPOptions Optional headers, timeout, and response type.

Promise<HTTPResponse>

An HTTPResponse with status, statusText, headers, and data.

MobileLockerHTTPError on network failure or timeout.

MobileLockerHttpResponseError on non-2xx responses.

post(
url,
body?,
options?): Promise<HTTPResponse>;

Make a POST request to an external URL.

Parameter Type Description
url string The full URL to request.
body? unknown Request body, serialized as JSON.
options? HTTPOptions Optional headers, timeout, and response type.

Promise<HTTPResponse>

An HTTPResponse.

MobileLockerHTTPError on network failure or timeout.

MobileLockerHttpResponseError on non-2xx responses.

put(
url,
body?,
options?): Promise<HTTPResponse>;

Make a PUT request to an external URL.

Parameter Type Description
url string The full URL to request.
body? unknown Request body, serialized as JSON.
options? HTTPOptions Optional headers, timeout, and response type.

Promise<HTTPResponse>

An HTTPResponse.

MobileLockerHTTPError on network failure or timeout.

MobileLockerHttpResponseError on non-2xx responses.

patch(
url,
body?,
options?): Promise<HTTPResponse>;

Make a PATCH request to an external URL.

Parameter Type Description
url string The full URL to request.
body? unknown Request body, serialized as JSON.
options? HTTPOptions Optional headers, timeout, and response type.

Promise<HTTPResponse>

An HTTPResponse.

MobileLockerHTTPError on network failure or timeout.

MobileLockerHttpResponseError on non-2xx responses.

delete(url, options?): Promise<HTTPResponse>;

Make a DELETE request to an external URL.

Parameter Type Description
url string The full URL to request.
options? HTTPOptions Optional headers, timeout, and response type.

Promise<HTTPResponse>

An HTTPResponse.

MobileLockerHTTPError on network failure or timeout.

MobileLockerHttpResponseError on non-2xx responses.

request: (url, options) => Promise<HTTPResponse>;

Make an HTTP request with full control over method and options.

Parameter Type Description
url string The full URL to request.
options HTTPRequestOptions Method, body, headers, timeout, and response type.

Promise<HTTPResponse>

An HTTPResponse.

MobileLockerHTTPError on network failure or timeout.

MobileLockerHttpResponseError on non-2xx responses.