The passing delegating handler, is typically a chain of handlers. However, AddMiddleware assigns the outer handler to the very first element in the chain of handlers, like this:
This behavior disrupts the intended sequence of handlers in the chain. A better approach would be for AddMiddleware to follow the chain to its end before making any assignments.
while (middleware.InnerHandler is DelegatingHandler delegatingHandler)
{
middleware = delegatingHandler;
}
middleware.InnerHandler = outerHandler;
Flurl.Http 4.0.2
The passing delegating handler, is typically a chain of handlers. However, AddMiddleware assigns the outer handler to the very first element in the chain of handlers, like this:
This behavior disrupts the intended sequence of handlers in the chain. A better approach would be for AddMiddleware to follow the chain to its end before making any assignments.