An Axios request interceptor to fill the authorization header for qiniu api.
npm install qiniu-axios-request-interceptornpm install qiniu-axios-request-interceptor
ts
import Axios from 'axios';
import {QiniuAxiosRequestInterceptor} from 'qiniu-axios-request-interceptor';
let axios = Axios.create({ baseURL: 'https://api.qiniu.com' });
let accesskey = process.env.ACCESS_KEY;
let secretkey = process.env.SECRET_KEY;
let interceptor = QiniuAxiosRequestInterceptor.createV2(accesskey, secretkey);
let request = axios.interceptors.request;
request.use(interceptor);
// Then you can use this axios instance to perform api request to qiniu api
// without calculating the authorization header yourself.
`
How to contribute
1. Make sure you have installed bun.
2. Install dependencies:
`bash
bun install
`
3. Modify index.ts and index.spec.ts
4. Make sure your modifications pass tests:
`bash
bun run test
`
5. Send a PR 💕
Others
You can find more interesting things about me here:
+ https://github.com/DevDengChao
+ https://blog.dengchao.fun
This project was created using bun init` in bun v1.2.2. Bun is a fast all-in-one JavaScript runtime.