Add middleware and a handler to a route as per the readme, call the route and the handler and middleware run twice, the output is a concat of the two handlers' output.
Expected Behavior
Middleware should run once, handler should run once
Steps To Reproduce
Create the simple example in the readme and then call a router, the middleware and handler will run twice.
Is there an existing issue for this?
Current Behavior
Add middleware and a handler to a route as per the readme, call the route and the handler and middleware run twice, the output is a concat of the two handlers' output.
Expected Behavior
Middleware should run once, handler should run once
Steps To Reproduce
Create the simple example in the readme and then call a router, the middleware and handler will run twice.
Anything else?
This works as expected:
This causes the failure:
This problem is caused by passing a function which has a pointer reciever. The fix is to return an anonymous function:
However, I want to access specific struct data in the handler context. Looking at the source code:
I'm implementing that interface so it should work. Looking at the readme https://github.com/gorilla/mux?tab=readme-ov-file#middleware what Im doing is documented but this causes a double response.