1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-14 01:26:23 +01:00

Set correct Content-Type header on PUT requests (application/octet-stream).

Rails 1.2 seems to be more strict in this regard.
This commit is contained in:
Dr. Peter Poeml 2007-06-21 15:14:15 +00:00
parent 751bc409ac
commit 955c45868c

View File

@ -656,6 +656,11 @@ def http_request(method, url, data=None, file=None):
req = urllib2.Request(url)
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':
req.add_header('Content-Type', 'application/octet-stream')
if file and not data:
size = os.path.getsize(file)
if size < 1024*512: