From 0d82f9e660db885bbaff667bee5d91d378f75f22 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 8 Jul 2026 10:07:04 +0000 Subject: [PATCH 1/2] =?UTF-8?q?Declare=20the=20XML=20content=20type=20the?= =?UTF-8?q?=20Abri=20relay=20requires=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- tests/infrastructure/abri/test_abri_client.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/infrastructure/abri/test_abri_client.py b/tests/infrastructure/abri/test_abri_client.py index fff0a3865..13bac577b 100644 --- a/tests/infrastructure/abri/test_abri_client.py +++ b/tests/infrastructure/abri/test_abri_client.py @@ -129,6 +129,22 @@ def test_log_job_sends_the_recorded_logjob_envelope_to_the_relay_endpoint( ) +def test_log_job_declares_the_xml_body_content_type_the_relay_requires( + client: AbriClient, mock_session: MagicMock +) -> None: + # Arrange: the relay 400s an XML body posted without an XML content type. + mock_session.post.return_value.content = _load_fixture( + "abri_relay_logjob_success_response.xml" + ) + + # Act + client.log_job(_spec_example_request()) + + # Assert + headers: dict[str, str] = mock_session.post.call_args.kwargs["headers"] + assert headers["Content-Type"] == "application/xml" + + # --- abandon_job: rejection (canceljob's own error-details shape) --- From fe167f077f06c05c603c43765d1d04ebf25da1ff Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 8 Jul 2026 10:08:06 +0000 Subject: [PATCH 2/2] =?UTF-8?q?Declare=20the=20XML=20content=20type=20the?= =?UTF-8?q?=20Abri=20relay=20requires=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- infrastructure/abri/abri_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/infrastructure/abri/abri_client.py b/infrastructure/abri/abri_client.py index 7c9c018a9..ebcd65f64 100644 --- a/infrastructure/abri/abri_client.py +++ b/infrastructure/abri/abri_client.py @@ -142,7 +142,11 @@ class AbriClient: def _post(self, envelope: bytes) -> bytes: try: - response = self._session.post(self._config.endpoint_url, data=envelope) + response = self._session.post( + self._config.endpoint_url, + data=envelope, + headers={"Content-Type": "application/xml"}, + ) response.raise_for_status() except requests.RequestException as error: raise AbriTransportError(str(error)) from error