Error response depends on the 'content-type' header of request