the http response code is not accurate
When Unsupported Content-Type, it is best to return HTTPUnsupportedMediaType Change-Id: If0c11e2ab4645d2acc61c9845c0abd6e12a40df9
This commit is contained in:
parent
53c78de6ca
commit
2350cc7496
@ -616,7 +616,7 @@ class ResourceTest(base.BaseTestCase):
|
||||
resource = wsgi.Resource(Controller(), my_fault_body_function)
|
||||
request = FakeRequest()
|
||||
result = resource(request)
|
||||
self.assertEqual(400, result.status_int)
|
||||
self.assertEqual(415, result.status_int)
|
||||
|
||||
def test_type_error(self):
|
||||
class Controller(object):
|
||||
|
@ -787,7 +787,7 @@ class Resource(Application):
|
||||
action, args, accept = self.deserializer.deserialize(request)
|
||||
except exception.InvalidContentType:
|
||||
LOG.exception("InvalidContentType: Unsupported Content-Type")
|
||||
return Fault(webob.exc.HTTPBadRequest(
|
||||
return Fault(webob.exc.HTTPUnsupportedMediaType(
|
||||
explanation=_("Unsupported Content-Type")))
|
||||
except exception.MalformedRequestBody:
|
||||
LOG.exception("MalformedRequestBody: Malformed request body")
|
||||
|
Loading…
Reference in New Issue
Block a user