feat(request): add a response-interceptor seam

Add `extraResponseInterceptors` next to the existing request-interceptor
seam and wire it into the request config, so build-time tooling can react
to responses (e.g. clear a one-shot request-scoped hint after a write
completes). Default is an empty list — no behavior change by default.
This commit is contained in:
gitlawr
2026-06-03 10:14:50 +08:00
committed by jialin
parent 9061fa08ba
commit d2d82ee5ee
2 changed files with 16 additions and 2 deletions
+8
View File
@@ -13,3 +13,11 @@ export type RequestInterceptor = (
) => { url: string; options: Record<string, any> };
export const extraRequestInterceptors: RequestInterceptor[] = [];
// Response-side counterpart. Each interceptor receives the (successful)
// response and returns it; tooling may overwrite this file to react to
// responses (e.g. clearing a one-shot request-scoped hint after a write
// completes). Default is an empty list.
export type ResponseInterceptor = (response: any) => any;
export const extraResponseInterceptors: ResponseInterceptor[] = [];