From 602841f14baf6e79ba165c32b2cf6378f99d1a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Wed, 27 Nov 2013 11:13:08 +0100 Subject: [PATCH] - fix upload of binary files via POST api call (use right content type) --- osc/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osc/core.py b/osc/core.py index dd53400c..ce02452e 100644 --- a/osc/core.py +++ b/osc/core.py @@ -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({})):