Skip to content

onion-interceptor

洋葱拦截器

通用网络请求拦截器工具

Coverjs Logo

光速上手

typescript
import type { Context, Next } from "onion-interceptor";
import { createInterceptor } from "onion-interceptor";
import axios from "axios";

const http = axios.create({
  // ... some config
});

createInterceptor(http).use(async (ctx: Context, next: Next) => {
  console.log("interceptor start", ctx);
  await next();
  console.log("interceptor end", ctx);
});
export default http;

Released under the MIT License.