qiniu-axios-request-interceptor
v1.0.3
Published
An Axios request interceptor to fill the authorization header for qiniu api.
Readme
qiniu-axios-request-interceptor
An Axios request interceptor to fill the authorization header for qiniu api.
How to use
Install
Run
npm install qiniu-axios-request-interceptorCreate and add the interceptor to axios instance
import Axios from 'axios'; // import QiniuAxiosRequestInterceptor from 'qiniu-axios-request-interceptor'; // If you are using commonjs 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
Make sure you have installed bun.
Install dependencies:
bun installModify
index.tsandindex.spec.tsMake sure your modifications pass tests:
bun run testSend 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.
