Open
Description
Describe the bug
Interceptors aren't chained, in that global interceptors at the provider level, are overridden if an interceptor is introduced at the useFetch()
hook level
There does seem to be a work around, at the hook level -
request: async ({ options }) => {
globalOptions.interceptors?.request?.({ options });
...
However, that could easily be forgotten on a case per case basis, and is no different that just housing the 'global' interceptor code in a standard function, and just invoking that, which defeats the purpose of a global 'interceptor'
Please do this to easily reproduce the bug.
To Reproduce
- introduce a request interceptor at the provider level, to say, add a request correlation-id header
- introduce a request interceptor at the hook usage level, to say, add another request header
- When running the hook, the provider level request interceptor does not run.
Expected behavior
Both should run, probably the global first, then the more specific interceptor at the hook level second
Metadata
Assignees
Labels
No labels
Activity