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

- fix upload of binary files via POST api call (use right content type)

This commit is contained in:
Adrian Schröter 2013-11-27 11:13:08 +01:00
parent c0527db154
commit 9d8427d4c9

View File

@ -2933,8 +2933,8 @@ def http_request(method, url, headers={}, data=None, file=None, timeout=0):
req.get_method = lambda: method
# POST requests are application/x-www-form-urlencoded per default
# since we change the request into PUT, we also need to adjust the content type header
if method == 'PUT' or (method == 'POST' and data):
# but sending data requires an octet-stream type
if method == 'PUT' or (method == 'POST' and (data or file)):
req.add_header('Content-Type', 'application/octet-stream')
if isinstance(headers, type({})):