Bug 1024920 - added a middleware for reporting needs

> functional tests tests the features proposed by the API endpoints.

and index.js is the one binding those endpoints. utility functions should be places elsewhere. I also have concerns that you need to mimic HTTP endpoint to actually test simple functions. It looks like a lot of work for no benefit.

> This is a middleware, so we should be testing that the middleware is acting properly and then check that the middleware is indeed installed well for the routes we want.

The middleware also impacts the behavior of endpoints. So it makes sense to test it in that context.

> I don't understand why testing the middleware belongs to functional tests, especially because we test something that should be tested already in the middleware tests.

Because the data that is dumped via the functional test is provided in that case by this API endpoint, which fills req.