Adding a middleware handler
Adding a test for the middleware handler