Skip to content

Commit 01e891a

Browse files
authored
Fix: support 405 from POST /messages in broadcast fallback (#60)
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`.
1 parent 3b9885a commit 01e891a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/aleph/sdk/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ async def _broadcast(
11381138
json={"sync": sync, "message": message_dict},
11391139
) as response:
11401140
# The endpoint may be unavailable on this node, try the deprecated version.
1141-
if response.status == 404:
1141+
if response.status in (404, 405):
11421142
logger.warning(
11431143
"POST /messages/ not found. Defaulting to legacy endpoint..."
11441144
)

0 commit comments

Comments
 (0)