Skip to content

lspeasy / core/src / MiddlewareResult

Interface: MiddlewareResult

Defined in: packages/core/src/middleware/types.ts:125

The return value from a middleware function.

Remarks

Return undefined or void to continue the pipeline normally. Set shortCircuit: true (plus response or error) to bypass all remaining middleware and the final handler.

Never

NEVER short-circuit a request without providing a valid response or error — the pending request will never resolve and the client will time out with no recourse.

Properties

PropertyTypeDescriptionDefined in
error?ErrorResponseMessageThe error response to return when short-circuiting with a failure.packages/core/src/middleware/types.ts:131
response?| RequestMessage | NotificationMessage | ResponseMessageThe response to return when short-circuiting a request.packages/core/src/middleware/types.ts:129
shortCircuit?booleanWhen true, all remaining middleware and the final handler are bypassed.packages/core/src/middleware/types.ts:127

Released under the MIT License.