Switch to HTTP 204 to indicate no data to export

This is more robust, as it indicates the request was successfully
authenticated and processed, but that there is no data to export. This is
different from the URL not existing (which would also happen if the module was
unavailable, which should be a notable error instead).
This commit is contained in:
Matthew Wild
2022-01-11 11:20:57 +00:00
committed by Jonas Schäfer
parent 275b302531
commit 481379d03f
2 changed files with 9 additions and 12 deletions

View File

@@ -1129,11 +1129,13 @@ class ProsodyClient:
self,
*,
session: aiohttp.ClientSession,
) -> str:
) -> typing.Optional[str]:
async with session.get(
self._xep227_endpoint("/export?stores=roster,vcard,pep"),
) as resp:
self._raise_error_from_response(resp)
if resp.status == 204:
return None
return await resp.text()
@autosession