First draft of the httpmiddleware proposed in #27