Allow middlewares to modify the request.

There was a bug in the httploc implementation that passed in the different request to the endpoint and middlewares,
so all changes to middlewares were lost. Fixes #51