From c602d084534c2a551127030c900d30db6674bce9 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Mon, 5 Sep 2022 14:04:46 +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/core.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osc/core.py b/osc/core.py index 1cf4895e..04ceb317 100644 --- a/osc/core.py +++ b/osc/core.py @@ -3420,6 +3420,10 @@ def http_request(method, url, headers={}, data=None, file=None): req.get_method = lambda: method + # Rails sends a html response if the header is not set + # https://github.com/openSUSE/open-build-service/pull/13019 + req.add_header("Accept", "application/xml") + # POST requests are application/x-www-form-urlencoded per default # but sending data requires an octet-stream type if method == 'PUT' or (method == 'POST' and (data or file)):