Use detail instead of explanation for 415 errors
As of webob 1.5.1 415 exception does not have explanation in it's template. 'detail' is present in both versions templates. Also adds CONTENT_TYPE to test-requests environment, to allow tests to run correctly. Change-Id: I52f2686ee838eef38ea9c5f48fe5f9e093e82412 Partial-Bug: #1512390
This commit is contained in:
parent
47435e2a68
commit
577c550821
@ -404,7 +404,7 @@ class Resource(object):
|
||||
action, action_args, accept = self.deserialize_request(request)
|
||||
except exceptions.UnsupportedContentType:
|
||||
msg = _("Unsupported Content-Type")
|
||||
return webob.exc.HTTPUnsupportedMediaType(explanation=msg)
|
||||
return webob.exc.HTTPUnsupportedMediaType(detail=msg)
|
||||
except exceptions.MalformedRequestBody:
|
||||
msg = _("Malformed request body")
|
||||
return webob.exc.HTTPBadRequest(explanation=msg)
|
||||
|
@ -147,6 +147,7 @@ class ControllerTest(object):
|
||||
'PATH_INFO': path,
|
||||
'wsgi.url_scheme': 'http',
|
||||
'QUERY_STRING': '',
|
||||
'CONTENT_TYPE': 'application/json',
|
||||
}
|
||||
|
||||
def _simple_request(self, path, params=None, method='GET',
|
||||
|
Loading…
Reference in New Issue
Block a user