From 9d8427d4c952afd49c62835cd79590f215df0085 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 1d2543789..0499cfe72 100644 --- a/osc/core.py +++ b/osc/core.py @@ -2933,8 +2933,8 @@ def create_memoryview(obj): 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({})):