Skip to content

Commit

Permalink
- fix upload of binary files via POST api call (use right content type)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Dec 3, 2013
1 parent c0527db commit 9d8427d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions osc/core.py
Expand Up @@ -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({})):
Expand Down

0 comments on commit 9d8427d

Please sign in to comment.