Files
qdrant/tests/consensus_tests/assertions.py
Arnaud Gourlay fc77e3e511 Use systematically assert_http_ok for better error reporting (#1183)
* Use systematically assert_http_ok for better error reporting

* extraction assertion to use it outside of pytest
2022-11-01 11:19:13 +01:00

11 lines
388 B
Python

import requests
def assert_http_ok(response: requests.Response):
if response.status_code != 200:
if not response.content:
raise Exception(f"Http request failed with status {response.status_code} and no content")
else:
raise Exception(
f"Http request failed with status {response.status_code} and content:\n{response.json()}")