Add unit tests and fix HttpAcceptMiddleware.