Making Requests
A request entry plus seven shortcut methods (get / post / put / patch / del / head / options) with the method injected by the function name; a ready-to-use default instance and createRequest() for isolated instances
A full-featured HTTP request library for uni-app x
A request entry plus seven shortcut methods (get / post / put / patch / del / head / options) with the method injected by the function name; a ready-to-use default instance and createRequest() for isolated instances
baseURL joining, header shallow merge, timeout and validateStatus with three-level merging (built-in defaults → instance defaults → request level); everything except url is optional with null-safe fallbacks
params merge with existing query in the url and are encoded deterministically in the library; UTSJSONObject data of GET/HEAD is folded into the query; getUri() builds the full URL offline
Request/response chains support multiple ordered registrations with eject; the error chain offers recover (return a response), rethrow (return a new error) and pass-through (return null), aligned with axios semantics
Request-level transformRequest / transformResponse replace the built-in behavior when provided; built-in request body auto-serialization and pass-through response, with transformRequest receiving null for GET/HEAD
RequestError unifies invalid params/config, cancellation, timeout, network failure, status validation failure and native failures into 8 literal-union codes; nativeErrCode passes through unchanged, config and response are attached
createCancelSource() creates a cancel source; attach its token to config.cancelToken and cancel(reason) aborts all in-flight requests bound to it, rejecting with ERR_CANCELED
onTask exposes the native RequestTask for advanced scenarios such as chunked transfer listening; native options like enableQuic / sslVerify / withCredentials / enableChunked pass through untouched
Generically-typed `ResponseResult
Introduction → Quick Start → Making Requests → Request Config → Interceptors → Error Handling
