MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / invokeMiddleware

Function invokeMiddleware

packages/express/src/middleware.ts:209–227  ·  view source on GitHub ↗
(
  middlewareCtx: MiddlewareContext,
  options?: InvokeMiddlewareOptions,
)

Source from the content-addressed store, hash-verified

207 * @param options - Options to invoke the middleware chain
208 */
209export function invokeMiddleware(
210 middlewareCtx: MiddlewareContext,
211 options?: InvokeMiddlewareOptions,
212): ValueOrPromise<InvocationResult> {
213 debug(
214 'Invoke middleware chain for %s %s with options',
215 middlewareCtx.request.method,
216 middlewareCtx.request.originalUrl,
217 options,
218 );
219 let keys = options?.middlewareList;
220 if (keys == null) {
221 const view = new MiddlewareView(middlewareCtx, options);
222 keys = view.middlewareBindingKeys;
223 view.close();
224 }
225 const mwChain = new MiddlewareChain(middlewareCtx, keys);
226 return mwChain.invokeInterceptors(options?.next);
227}
228
229/**
230 * Watch middleware binding keys for the given context and sort them by

Callers 4

dummyRequestHandlerFunction · 0.90
actionMethod · 0.90
toExpressMiddlewareFunction · 0.85

Calls 2

invokeInterceptorsMethod · 0.80
closeMethod · 0.45

Tested by 1

dummyRequestHandlerFunction · 0.72