This commit is contained in:
Markos Gogoulos
2025-12-30 15:43:42 +02:00
parent 2c0bba1427
commit de0c16729b

View File

@@ -247,6 +247,11 @@ class DjangoServiceConnector(ServiceConnector):
response.raise_for_status() response.raise_for_status()
try:
response_body = response.json()
except ValueError:
raise ValueError(f"NRPS endpoint returned non-JSON response. Status: {response.status_code}, Content-Type: {response.headers.get('Content-Type')}, Body: {response.text[:500]}")
next_page_url = None next_page_url = None
link_header = response.headers.get('Link') link_header = response.headers.get('Link')
if link_header: if link_header:
@@ -255,7 +260,7 @@ class DjangoServiceConnector(ServiceConnector):
next_page_url = link.split(';')[0].strip('<> ') next_page_url = link.split(';')[0].strip('<> ')
return { return {
'body': response.json(), 'body': response_body,
'status_code': response.status_code, 'status_code': response.status_code,
'headers': dict(response.headers), 'headers': dict(response.headers),
'next_page_url': next_page_url, 'next_page_url': next_page_url,