Connectum API Reference / @connectum/interceptors / defaults / createDefaultInterceptors
Function: createDefaultInterceptors()
createDefaultInterceptors(
options?):Interceptor[]
Defined in: defaults.ts:128
Creates the default interceptor chain with the specified configuration.
The interceptor order is fixed and intentional:
- errorHandler - Catch-all error normalization (outermost, must be first)
- timeout - Enforce deadline before any processing
- bulkhead - Limit concurrency
- circuitBreaker - Prevent cascading failures
- retry - Retry transient failures (exponential backoff)
- fallback - Graceful degradation (DISABLED by default)
- validation - @connectrpc/validate (createValidateInterceptor)
- serializer - JSON serialization (innermost)
Parameters
options?
DefaultInterceptorOptions = {}
Configuration for each interceptor
Returns
Interceptor[]
Array of configured interceptors in the correct order
Example
typescript
// All defaults (fallback disabled)
const interceptors = createDefaultInterceptors();
// Disable retry, custom timeout
const interceptors = createDefaultInterceptors({
retry: false,
timeout: { duration: 10000 },
});
// Enable fallback with handler
const interceptors = createDefaultInterceptors({
fallback: { handler: () => ({ data: [] }) },
});
// No interceptors: omit `interceptors` option in createServer()
// or pass `interceptors: []`