PeerTube: 'Follow' requests are acknowledged with a 204 status code

This commit is contained in:
freamon 2024-05-25 19:43:25 +01:00
parent e83b929a73
commit 2abadb183f

View file

@ -101,7 +101,7 @@ def post_request(uri: str, body: dict | None, private_key: str, key_id: str, con
else: else:
try: try:
result = HttpSignature.signed_request(uri, body, private_key, key_id, content_type, method, timeout) result = HttpSignature.signed_request(uri, body, private_key, key_id, content_type, method, timeout)
if result.status_code != 200 and result.status_code != 202: if result.status_code != 200 and result.status_code != 202 and result.status_code != 204:
log.result = 'failure' log.result = 'failure'
log.exception_message += f' Response status code was {result.status_code}' log.exception_message += f' Response status code was {result.status_code}'
current_app.logger.error('Response code for post attempt was ' + current_app.logger.error('Response code for post attempt was ' +
@ -109,6 +109,8 @@ def post_request(uri: str, body: dict | None, private_key: str, key_id: str, con
log.exception_message += uri log.exception_message += uri
if result.status_code == 202: if result.status_code == 202:
log.exception_message += ' 202' log.exception_message += ' 202'
if result.status_code == 204:
log.exception_message += ' 204'
except Exception as e: except Exception as e:
log.result = 'failure' log.result = 'failure'
log.exception_message='could not send:' + str(e) log.exception_message='could not send:' + str(e)