From c2d0b05ede816361295b0164e27c6c7d35d67bc4 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Mon, 5 Sep 2022 09:01:04 +0200 Subject: [PATCH] Send HTTP header Accept: application/xml Rails sends a html response if the header is not set https://github.com/openSUSE/open-build-service/pull/13019 --- osc/connection.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osc/connection.py b/osc/connection.py index 8353544b..f3c0597e 100644 --- a/osc/connection.py +++ b/osc/connection.py @@ -268,6 +268,10 @@ def http_request(method, url, headers=None, data=None, file=None): if success: break + # Rails sends a html response if the header is not set + # https://github.com/openSUSE/open-build-service/pull/13019 + headers.add("Accept", "application/xml") + if data or file: # osc/obs data is usually XML headers.add("Content-Type", "application/xml; charset=utf-8")