简体中文 | English
An Axios-based request SDK with Fast response handling, extensible handlers and uni-app adapters.
Documentation · Official website
- Preserves Axios request and response interceptors, cancellation, parameter serialization,
validateStatus, and response transforms. - Handles Fast.NET
ApiResponsebusiness status, simplified data, messages, cache, Loading, and crypto extension points. - Routes uni-app
method: "upload" | "download"requests touni.uploadFileanduni.downloadFile. - Provides
axios.upload(),axios.download(), and typed uni-app platform configuration. - Provides Vite and Webpack mini-program plugins that replace Axios FormData and Blob platform modules only when needed.
- Publishes pure ESM, declarations, dedicated
viteandwebpacksubpaths, and a separately minified CDN entry from the repository root. - Validates runtime behavior, public types, package entries, Source Maps, the CDN global, the npm archive, and Publint before packing.
- Axios
^1.8.1. - Node.js
^22.18.0 || ^24.18.0and pnpm^11.0.0for repository development. @dcloudio/typesis recommended for typed uni-app applications.- uni-app mini-program builds require
miniprogram-formdataandminiprogram-blobin the application project.
pnpm add @fast-china/axios axiosInstall the platform polyfills in a mini-program project:
pnpm add miniprogram-formdata miniprogram-blobThe jsDelivr entry uses dist/index.global.min.js. Load Axios first, then access this SDK through the FastAxios global:
| Resource | jsDelivr | unpkg |
|---|---|---|
axios@1.8.1/dist/axios.min.js |
jsDelivr | unpkg |
@fast-china/axios/dist/index.global.min.js |
jsDelivr | unpkg |
<script src="https://cdn.jsdelivr.net/npm/axios@1.8.1/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@fast-china/axios/dist/index.global.min.js"></script>
<script>
FastAxios.createFastAxios({
baseUrl: "https://api.example.com",
requestCipher: false,
});
FastAxios.axiosUtil.request({
url: "/users/1",
method: "get",
requestType: "query",
});
</script>The CDN build is browser-only; uni-app and the Vite/Webpack plugins must use package-manager imports.
Create the global FastAxios container once during application startup, then send requests through axiosUtil.request():
import { axiosUtil, createFastAxios } from "@fast-china/axios";
createFastAxios({
baseUrl: "https://api.example.com",
timeout: 30_000,
requestCipher: false,
});
interface User {
id: number;
name: string;
}
const user = await axiosUtil.request<User>({
url: "/users/1",
method: "get",
requestType: "query",
});By default, axiosUtil.request() reads code, success, message, and data from the Fast.NET RESTful response and resolves with data. Disable simpleDataFormat or restfulResult on an individual request when the original structure is required.
Connect project feedback through handlers without coupling the SDK to a UI library:
import { useFastAxios } from "@fast-china/axios";
const fastAxios = useFastAxios();
fastAxios.message.error.use((message) => {
console.error(message);
});Run this after the preceding createFastAxios() initialization. uni-app mini-programs also need the documented build plugin; installing polyfills alone does not complete integration.
| Import or global | Purpose | Runtime |
|---|---|---|
@fast-china/axios |
FastAxios, axiosUtil, and the uni-app adapter |
Browser and uni-app |
@fast-china/axios/vite |
Vite mini-program FormData/Blob plugin | Node.js build configuration |
@fast-china/axios/webpack |
Webpack mini-program FormData/Blob plugin | Node.js build configuration |
FastAxios |
Minified IIFE root entry | Browser script tag |
Importing the package does not access window or uni. Platform APIs are accessed only when the adapter is created, a request runs, or the related feature is called.
- API reference
- uni-app adapter
- Runtime and package contract
- Development and release
- Contributing
- Security policy
- Changelog
corepack enable
pnpm install --frozen-lockfile
pnpm checkCopyright © 2018-Now 小方. This project uses Apache License 2.0. Use, modification, distribution and commercial use are permitted subject to its terms.
When redistributing, provide the license, mark modified files and preserve applicable copyright, attribution and supplied NOTICE information as required. This summary does not replace the license or impose additional UI attribution.
Users are responsible for the legal compliance and authorization of their own modifications, deployment, data processing and operations. This reminder is not an additional license condition.
Except as required by applicable law or agreed in writing, the software is provided on an "AS IS" basis. Sections 7 and 8 govern warranty disclaimers and liability limits. Providing the project does not endorse downstream activities or assume users' contractual commitments. This statement does not exclude liability that cannot lawfully be excluded.
