Defjs
Core

createSSEInterceptor

Wraps an SSEInterceptorFn as a tagged SSEInterceptor.

@defjs/core · Function

Signature

function createSSEInterceptor(fn: SSEInterceptorFn): SSEInterceptor;

Returns { kind: 'sse', fn }. SSE interceptors run only for SSE operations, in registration order; next(req) opens the stream through the remaining interceptors.

A deterministic URL error from next(req) rejects the returned promise, so .then or .catch recovery runs; if it is not recovered, the operation still reports REQ_BUILD_FAILED.

EventStreamHandle extends AsyncDisposable. A structural short-circuit implementation must provide [Symbol.asyncDispose](): PromiseLike<void> and connect it to the same close lifecycle.

Parameters

Prop

Type

fn SSEInterceptorFn

SSE interceptor function.

Returns

An SSEInterceptor with kind: 'sse'.

Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao