Portal Requests
Coroutine-based HTTP transport used by every API class in the SDK.
HTTP error semantics (since 9.0.0):
200 / 204 → returns body / empty string.
400 Bad Request → throws io.portalhq.android.exceptions.PortalException.Api.HttpBadRequest carrying the raw body and the extracted error message. Exception: postEnclaveMPCApi passes
wrapErrorInJson = trueand receives the wrapped error body as a string instead (preserved for the MPC enclave parser).401 Unauthorized → throws io.portalhq.android.exceptions.PortalException.Api.HttpUnauthorized.
All other HTTP status codes (4xx ≥ 402, 5xx, -1) → throws io.portalhq.android.exceptions.PortalException.Api.HttpRequestFailed.
Transport-level I/O failures (DNS, connection timeouts, socket reads, payload writes) propagate as raw java.io.IOException — not wrapped.
disconnect() is guaranteed on every path via a try/finally wrapper.
Timeouts: every request is bounded. HttpURLConnection defaults both timeouts to 0, meaning infinite, so a backend or proxy that accepts the TCP connection and never answers would otherwise suspend the caller until process death — and callers that hold a lock across a request (PortalAuth holds grantLock across the grant exchange, so a hang there wedges sign-out too) have no way to recover, since the blocking read on Dispatchers.IO is not cancellable and a withTimeout around it would not release the lock.
Parameters
See the property of the same name.
Cap on establishing the connection.
Cap on waiting for response data. Matches the 60s iOS URLSessionConfiguration.default request timeout; postEnclaveMPCApi overrides it, see ENCLAVE_READ_TIMEOUT_MS.