Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/tests/unit/webhooks/test_unit_webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,10 @@ def test_send_test_webhook__various_error_status_codes__returns_correct_response
mock_post.assert_called_once()
response_json = response.json()
assert response_json["status"] == external_api_response_status
assert response_json["detail"] == "Webhook returned invalid status"
assert response_json["detail"] == "Webhook returned error status"
assert (
response_json["body"]
== "Please check the webhook endpoint to validate it returns a 200 OK."
== f"Webhook returned HTTP {external_api_response_status}."
)


Expand Down
6 changes: 3 additions & 3 deletions api/webhooks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def test(self, request: Request) -> Response:
else WebhookType.ENVIRONMENT
)
response = send_test_request_to_webhook(webhook_url, secret, webhook_type)
if response.status_code != 200:
if response.status_code >= 400:
return Response(
{
"detail": "Webhook returned invalid status",
"body": "Please check the webhook endpoint to validate it returns a 200 OK.",
"detail": "Webhook returned error status",
"body": f"Webhook returned HTTP {response.status_code}.",
"status": response.status_code,
},
status=status.HTTP_400_BAD_REQUEST,
Expand Down
Loading