Refactor formatters and add unit tests for them
Allow API error messages to set the Content-Type header