Ignore bad requests in notification hook
The notification engine is raising internal server error when trying to process invalid requests such as unauthorized call. This change avoid processing request with status code >= 400. Change-Id: Id7b9f4b342eebcc6258ecc6786e7c0b81c77def4
This commit is contained in:
parent
c10e5bd1bc
commit
9c8e4b5779
|
@ -68,6 +68,10 @@ class NotificationHook(hooks.PecanHook):
|
|||
if state.request.method not in ['POST', 'PUT', 'DELETE']:
|
||||
return
|
||||
|
||||
# Ignore requests that failed
|
||||
if state.response.status_code >= 400:
|
||||
return
|
||||
|
||||
request = state.request
|
||||
response = state.response
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ class TestNotificationHook(base.BaseDbTestCase):
|
|||
mock_state.request.headers = {'Referer': 'http://localhost/'}
|
||||
mock_state.request.query_string = ''
|
||||
mock_state.request.path = '/v1/tasks/1'
|
||||
mock_state.response.status_code = '200'
|
||||
mock_state.response.status_code = 200
|
||||
mock_state.old_entity_values = sot_json
|
||||
mock_get_original_resource.return_value = smt_json
|
||||
|
||||
|
|
Loading…
Reference in New Issue