openrasta/openrasta-core — pull request #79 by andrewchaa (2014-12-17 10:53:15+00:00)
Title: Return 400 BadRequest if accept hader is malformed and can't be parsed

At Huddle, we had several occurrences that the server receive requests with malformed accept header. MediaType cannot parse the header and throws FormatException, which causes the server to return 500 InternalServerError, writing error logs. After some discussion, our consensus is that OpenRasta logs warning and return 400 BadRequest

* Used try, catch in parsing and find media types from Accept header.
* Return 400 BadRequest and Render now.
* Added a unit test