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
Type Declaration
Section titled “Type Declaration”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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
url |
string |
The full URL to request. |
options? |
HTTPOptions |
Optional headers, timeout, and response type. |
Returns
Section titled “Returns”Promise<HTTPResponse>
An HTTPResponse with status, statusText, headers, and data.
Throws
Section titled “Throws”MobileLockerHTTPError on network failure or timeout.
Throws
Section titled “Throws”MobileLockerHttpResponseError on non-2xx responses.
post()
Section titled “post()”post( url, body?,options?): Promise<HTTPResponse>;Make a POST request to an external URL.
Parameters
Section titled “Parameters”| 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. |
Returns
Section titled “Returns”Promise<HTTPResponse>
An HTTPResponse.
Throws
Section titled “Throws”MobileLockerHTTPError on network failure or timeout.
Throws
Section titled “Throws”MobileLockerHttpResponseError on non-2xx responses.
put( url, body?,options?): Promise<HTTPResponse>;Make a PUT request to an external URL.
Parameters
Section titled “Parameters”| 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. |
Returns
Section titled “Returns”Promise<HTTPResponse>
An HTTPResponse.
Throws
Section titled “Throws”MobileLockerHTTPError on network failure or timeout.
Throws
Section titled “Throws”MobileLockerHttpResponseError on non-2xx responses.
patch()
Section titled “patch()”patch( url, body?,options?): Promise<HTTPResponse>;Make a PATCH request to an external URL.
Parameters
Section titled “Parameters”| 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. |
Returns
Section titled “Returns”Promise<HTTPResponse>
An HTTPResponse.
Throws
Section titled “Throws”MobileLockerHTTPError on network failure or timeout.
Throws
Section titled “Throws”MobileLockerHttpResponseError on non-2xx responses.
delete()
Section titled “delete()”delete(url, options?): Promise<HTTPResponse>;Make a DELETE request to an external URL.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
url |
string |
The full URL to request. |
options? |
HTTPOptions |
Optional headers, timeout, and response type. |
Returns
Section titled “Returns”Promise<HTTPResponse>
An HTTPResponse.
Throws
Section titled “Throws”MobileLockerHTTPError on network failure or timeout.
Throws
Section titled “Throws”MobileLockerHttpResponseError on non-2xx responses.
request
Section titled “request”request: (url, options) => Promise<HTTPResponse>;Make an HTTP request with full control over method and options.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
url |
string |
The full URL to request. |
options |
HTTPRequestOptions |
Method, body, headers, timeout, and response type. |
Returns
Section titled “Returns”Promise<HTTPResponse>
An HTTPResponse.
Throws
Section titled “Throws”MobileLockerHTTPError on network failure or timeout.
Throws
Section titled “Throws”MobileLockerHttpResponseError on non-2xx responses.