diff --git a/euphrosyne/assets/js/web-components/open-theso-type-ahead.ts b/euphrosyne/assets/js/web-components/open-theso-type-ahead.ts index 019e00373..1b9430bd5 100644 --- a/euphrosyne/assets/js/web-components/open-theso-type-ahead.ts +++ b/euphrosyne/assets/js/web-components/open-theso-type-ahead.ts @@ -26,7 +26,9 @@ export abstract class OpenThesoTypeAhead extends TypeAheadList { // autocomplete url = `https://opentheso.huma-num.fr/opentheso/openapi/v1/concept/${this.thesorusId}/autocomplete/${q}?lang=fr&exactMatch=false`; } - const response = await fetch(url); + const response = await fetch(url, { + headers: { Accept: "application/json" }, + }); if (response && response.status === 404) { return []; diff --git a/lab/tests/test_opentheso.py b/lab/tests/test_opentheso.py index 6ad71e70e..71c6c9987 100644 --- a/lab/tests/test_opentheso.py +++ b/lab/tests/test_opentheso.py @@ -15,6 +15,7 @@ def test_fetch_parent_ids_from_id(request_mock: mock.MagicMock): assert fetch_parent_ids_from_id("theso_id", "concept_id") == ["FIRST", "SECOND"] request_mock.get.assert_called_once_with( # pylint: disable=line-too-long - "https://opentheso.huma-num.fr/opentheso/openapi/v1/concept/theso_id/concept_id/expansion?way=top", + "https://opentheso.huma-num.fr/openapi/v1/concept/theso_id/concept_id/expansion?way=top", + headers={"Accept": "application/json"}, timeout=5, ) diff --git a/lab/thesauri/opentheso.py b/lab/thesauri/opentheso.py index b3f8b3d24..fd66b32b1 100644 --- a/lab/thesauri/opentheso.py +++ b/lab/thesauri/opentheso.py @@ -14,7 +14,8 @@ def fetch_parent_ids_from_id(theso_id: str, concept_id: str) -> list[str]: try: response = requests.get( # pylint: disable=line-too-long - f"https://opentheso.huma-num.fr/opentheso/openapi/v1/concept/{theso_id}/{concept_id}/expansion?way=top", + f"https://opentheso.huma-num.fr/openapi/v1/concept/{theso_id}/{concept_id}/expansion?way=top", + headers={"Accept": "application/json"}, timeout=5, ) except requests.exceptions.RequestException as e: