Skip to content

Type Alias: FetchInterceptors ​

FetchInterceptors = object

Defined in: packages/fetch/src/types/interceptors.ts:205

All valid interceptors for fetch requests are: ​

  1. error
  2. request
  3. response
  4. result

An interceptor can be any of the following: ​

  1. synchronous function
  2. synchronous function that returns a promise (or sometimes returns a promise)
  3. asynchronous functions

An interceptor can return: ​

  1. undefined (void/no return): plain interceptor that does other stuff but does not transform
  2. value: act as a transformer. Returned value depends on the type of interceptor.
  3. promise resolves with (1) value or (2) undefined

PS: ​

  1. Any exception thrown by interceptors will gracefully ignored.
  2. Interceptors will be executed in the sequence they're given.
  3. Execution priority: global interceptors will always be executed before local interceptors.
  4. The following options cannot be modified using interceptors: abortCtrl, as, signal, timeout

More info about specific interceptor types & examples: ​

See the following for more details and examples:

Properties ​

error? ​

optional error?: FetchInterceptorError | FetchInterceptorError[]

Defined in: packages/fetch/src/types/interceptors.ts:207

Request error interceptors/transformers. See FetchInterceptorError for more details.


request? ​

optional request?: FetchInterceptorRequest | FetchInterceptorRequest[]

Defined in: packages/fetch/src/types/interceptors.ts:209

Request request interceptors/transformers. See FetchInterceptorRequest for more details.


response? ​

optional response?: FetchInterceptorResponse | FetchInterceptorResponse[]

Defined in: packages/fetch/src/types/interceptors.ts:211

Request response interceptors/transformers. See FetchInterceptorResponse for more details.


result? ​

optional result?: FetchInterceptorResult | FetchInterceptorResult[]

Defined in: packages/fetch/src/types/interceptors.ts:213

Request result interceptors/transformers. See FetchInterceptorResult for more details.