mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-03 15:50:12 -04:00
Use correct HTTP status code for bad content type
415 is the status code for ‘Unsupported media type’ https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415
This commit is contained in:
@@ -24,7 +24,7 @@ def create_broadcast():
|
||||
if request.content_type != 'application/cap+xml':
|
||||
raise BadRequestError(
|
||||
message=f'Content type {request.content_type} not supported',
|
||||
status_code=400,
|
||||
status_code=415,
|
||||
)
|
||||
|
||||
cap_xml = request.get_data(as_text=True)
|
||||
|
||||
@@ -51,13 +51,13 @@ def test_valid_post_broadcast_returns_201(
|
||||
headers=[('Content-Type', 'application/json'), auth_header],
|
||||
)
|
||||
|
||||
assert response.status_code == 400
|
||||
assert response.status_code == 415
|
||||
assert json.loads(response.get_data(as_text=True)) == {
|
||||
'errors': [{
|
||||
'error': 'BadRequestError',
|
||||
'message': 'Content type application/json not supported'
|
||||
}],
|
||||
'status_code': 400,
|
||||
'status_code': 415,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user