axiosUtil
axiosUtil.request<Output, Input>(config) Request
Executes a Fast request and returns Promise<Output>.
ts
const data = await axiosUtil.request<User, CreateUserInput>({
url: "/users",
method: "post",
data: { name: "Fast" },
requestType: "add",
});Initialize the global FastAxios container first. Public AxiosRequestConfig fields remain supported.
axiosUtil.downloadFile(response) Download
Saves an existing Axios file response using browser Blob, Object URL, and a temporary anchor. No DOM download runs in uni-app. Content-Disposition takes precedence for filenames.
Throws Error when browser download APIs are unavailable.
axiosUtil.request Request
Executes an Axios request using Fast request conventions.
Signature
ts
request<Output = unknown, Input = unknown>(config: FastAxiosRequestConfig<Input>): Promise<Output>;Example
ts
import { axiosUtil } from "@fast-china/axios";
interface User {
id: number;
name: string;
}
const result = await axiosUtil.request<User, { name: string }>({ url: "/users", method: "post", requestType: "add", data: { name: "Fast" } });Input
| Input | Type | Required / default | Description |
|---|---|---|---|
config | FastAxiosRequestConfig<Input> | Required | Native Axios configuration plus Fast request options. |
Returns
| Value | Type | Description |
|---|---|---|
result | Promise<Output> | Simplified business data, custom handler result, raw response body, or file AxiosResponse. |
axiosUtil.downloadFile Download
Saves an existing Axios file response in a browser.
Signature
ts
downloadFile(response: AxiosResponse): void;Example
ts
import axios from "axios";
import { axiosUtil } from "@fast-china/axios";
const response = await axios.get<Blob>("/reports/1", { responseType: "blob" });
axiosUtil.downloadFile(response);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
response | AxiosResponse | Required | File response containing a Blob or data accepted by the Blob constructor. |
Returns
| Value | Type | Description |
|---|---|---|
result | void | No return value; uni-app performs no DOM download. |
