chg: Show size when the json is not loadable.

pull/700/head
Raphaël Vinot 2021-01-19 18:02:25 +01:00
parent 5e73bce618
commit ae1bdda67c
1 changed files with 2 additions and 1 deletions

View File

@ -3108,7 +3108,8 @@ class PyMISP:
except Exception:
logger.debug(response.text)
if expect_json:
raise PyMISPUnexpectedResponse(f'Unexpected response from server: {response.text}')
error_msg = f'Unexpected response (size: {len(response.text)}) from server: {response.text}'
raise PyMISPUnexpectedResponse(error_msg)
if lenient_response_type and not response.headers['Content-Type'].startswith('application/json'):
return response.text
if not response.content: