I’m working on my first Expressive application and I just noticed that any pipeline middleware registered before the
DispatchMiddleware::class runs twice. If I pipe a middleware after
DispatchMiddleware::class, it still runs once, although the route is found and the registered handler for it returns a response.
I discovered this while testing a middleware that needs to write a file to a folder and it just writes two files for each request. The application is created based on the Skeleton app and it’s using the latest versions for both Expressive and the Skeleton app. I’ve tested both with the
ApplicationConfigInjectionDelegator and without it.
If I add my file-writing middleware as a routed middleware, it works just as expected (runs only once, if added before the handler and doesn’t run, if added after it) …
Did anyone experienced something similar?
All the best