Skip to content

Function: composeMiddleware()

function composeMiddleware(middleware, core): (ctx) => Promise<Response>;

Defined in: rine-ts-sdk/src/api/middleware.ts:159

Fold a middleware array into a single bound pipeline.

Composed once at SDKHttpClient construction. The first element of middleware is the outermost layer (called first); the last element is adjacent to core. Order corresponds to the reader's mental model: a loggingMiddleware placed first wraps everything below it.

user's middleware[0]  ← outermost, called first
  └── user's middleware[1]
      └── user's middleware[2]
          └── core request

Parameters

Parameter Type
middleware readonly RineMiddleware[]
core (ctx) => Promise\<Response>

Returns

(ctx) => Promise\<Response>