1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-22 18:22:12 +01:00

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
This commit is contained in:
Daniel Mach 2022-09-05 14:04:46 +02:00
parent cedc7c006f
commit c602d08453

View File

@ -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)):