Skip to content

Pipeline is rejoined only if middleware does not short-circuit #33662

@deep-outcome

Description

@deep-outcome

Description

From https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-8.0#branch-the-middleware-pipeline

UseWhen also branches the request pipeline based on the result of the given predicate. Unlike with MapWhen, this branch is rejoined to the main pipeline if it doesn't short-circuit or contain a terminal middleware:

From https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-8.0

When a middleware short-circuits, it's called a terminal middleware because it prevents further middleware from processing the request.

Thus, as I understand, there has to be either "doesn't short-circuit" or "contain a terminal middleware" but no both.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-8.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/middleware/index.md

Document ID

3926c686-0ccc-f9fe-ca52-0134612a1623

Article author

@tdykstra


Associated WorkItem - 357008

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions