Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

408 to 504 mapping #520

Merged
merged 7 commits into from
Dec 2, 2024
Merged
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
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Brewtils Changelog
==================

3.29.1
------
TBD

- Updated Wait Timeout Exception expected HTTP code from 408 to 504

3.29.0
------
11/25/24
Expand Down
6 changes: 3 additions & 3 deletions brewtils/rest/easy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def handle_response_failure(response, default_exc=RestError, raise_404=True):

Raises:
NotFoundError: Status code 404 and raise_404 is True
WaitExceededError: Status code 408
ConflictError: Status code 409
TooLargeError: Status code 413
ValidationError: Any other 4xx status codes
RestConnectionError: Status code 503
WaitExceededError: Status code 504
default_exc: Any other status code
"""
try:
Expand All @@ -79,8 +79,6 @@ def handle_response_failure(response, default_exc=RestError, raise_404=True):
raise NotFoundError(message)
else:
return None
elif response.status_code == 408:
raise WaitExceededError(message)
elif response.status_code == 409:
raise ConflictError(message)
elif response.status_code == 413:
Expand All @@ -89,6 +87,8 @@ def handle_response_failure(response, default_exc=RestError, raise_404=True):
raise ValidationError(message)
elif response.status_code == 503:
raise RestConnectionError(message)
elif response.status_code == 504:
raise WaitExceededError(message)
else:
raise default_exc(message)

Expand Down
2 changes: 1 addition & 1 deletion test/rest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def not_found():

@pytest.fixture
def wait_exceeded():
return Mock(ok=False, status_code=408, json=Mock(return_value="payload"))
return Mock(ok=False, status_code=504, json=Mock(return_value="payload"))


@pytest.fixture
Expand Down
Loading