Use contentType method and charset property instead of res.header.
Move BadRequest into separate file, with inheritance test.
Give names to middleware function expressions to aid debugging and avoid arguments.callee.