Skip to content

Commit

Permalink
Fix: support 405 from POST /messages in broadcast fallback (#60)
Browse files Browse the repository at this point in the history
Problem: a user reports that publishing a message falls because of a 405
error returned from `POST /messages`. The fallback only takes 404 into
account, but a 405 is actually more likely because `GET /messages` exists.

Solution: accept both 404 and 405 as a sign that the node does not
support `POST /messages`.
  • Loading branch information
odesenfans authored Sep 19, 2023
1 parent 3b9885a commit 01e891a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/aleph/sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ async def _broadcast(
json={"sync": sync, "message": message_dict},
) as response:
# The endpoint may be unavailable on this node, try the deprecated version.
if response.status == 404:
if response.status in (404, 405):
logger.warning(
"POST /messages/ not found. Defaulting to legacy endpoint..."
)
Expand Down

0 comments on commit 01e891a

Please sign in to comment.