A middleware for auto-calculating the Content-Length header of the response