I'm making posts requests with curl using this, and even more simple than this:
curl -u usr:pwd -H "Content-Type: multipart/form-data" -i --form "file=@/path/to/myfile/myfile.zip" -X POST http://midominio.co/api/mypostrequest/
but I'm always getting an empty body, this what I'm getting:
{
'session': <django.contrib.sessions.backends.db.SessionStore object at 0x7f118e502b90>,
'_post': <QueryDict: {}>,
'content_params': {'boundary': '------------------------axxxxxxxxx'},
'_post_parse_error': False,
'_messages': <django.contrib.messages.storage.fallback.FallbackStorage object at 0x7f118e502d90>,
'resolver_match': ResolverMatch(func=piston.resource.Resource, args=(), kwargs={}, url_name=None, app_names=[], namespaces=[]),
'GET': <QueryDict: {}>,
'_stream': <django.core.handlers.wsgi.LimitedStream object at 0x7f118e502b50>,
'COOKIES': {},
'_files': <MultiValueDict: {}>,
'_read_started': False,
'META': {'HTTP_AUTHORIZATION': 'Basic Y2FpbjpjYWlu',
'SERVER_SOFTWARE': 'gunicorn/19.7.1',
'SCRIPT_NAME': u'',
'REQUEST_METHOD': 'POST',
'PATH_INFO': u'/api/mypostrequest/',
'SERVER_PROTOCOL': 'HTTP/1.0',
'QUERY_STRING': '',
'CONTENT_LENGTH': '180',
'HTTP_USER_AGENT': 'curl/7.51.0',
'HTTP_CONNECTION': 'close',
'SERVER_NAME': 'midominio.co',
'REMOTE_ADDR': '',
'wsgi.url_scheme': 'http',
'SERVER_PORT': '80',
'wsgi.input': <gunicorn.http.body.Body object at 0x7f118e5029d0>,
'HTTP_HOST': 'midominio.co',
'wsgi.multithread': False,
'HTTP_ACCEPT': '*/*',
'wsgi.version': (1, 0),
'RAW_URI': '/api/mypostrequest/',
'wsgi.run_once': False,
'wsgi.errors': <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f118e502950>,
'wsgi.multiprocess': True,
'gunicorn.socket': <socket._socketobject object at 0x7f118e4f6de0>,
'CONTENT_TYPE': 'multipart/form-data; boundary=------------------------axxxxxxxxx',
'HTTP_X_FORWARDED_FOR': '186.00.00.000',
'wsgi.file_wrapper': <class 'gunicorn.http.wsgi.FileWrapper'>},
'environ': {'HTTP_AUTHORIZATION': 'Basic Y2FpbjpjYWlu',
'SERVER_SOFTWARE': 'gunicorn/19.7.1',
'SCRIPT_NAME': u'',
'REQUEST_METHOD': 'POST',
'PATH_INFO': u'/api/mypostrequest/',
'SERVER_PROTOCOL': 'HTTP/1.0',
'QUERY_STRING': '',
'CONTENT_LENGTH': '180',
'HTTP_USER_AGENT': 'curl/7.51.0',
'HTTP_CONNECTION': 'close',
'SERVER_NAME': 'midominio.co',
'REMOTE_ADDR': '',
'wsgi.url_scheme': 'http',
'SERVER_PORT': '80',
'wsgi.input': <gunicorn.http.body.Body object at 0x7f118e5029d0>,
'HTTP_HOST': 'midominio.co',
'wsgi.multithread': False,
'HTTP_ACCEPT': '*/*',
'wsgi.version': (1, 0),
'RAW_URI': '/api/mypostrequest/',
'wsgi.run_once': False,
'wsgi.errors': <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f118e502950>,
'wsgi.multiprocess': True,
'gunicorn.socket': <socket._socketobject object at 0x7f118e4f6de0>,
'CONTENT_TYPE': 'multipart/form-data; boundary=------------------------axxxxxxxxx',
'HTTP_X_FORWARDED_FOR': '186.00.00.000',
'wsgi.file_wrapper': <class 'gunicorn.http.wsgi.FileWrapper'>},
'path_info': u'/api/mypostrequest/',
'content_type': 'multipart/form-data; boundary=------------------------axxxxxxxxx',
'path': u'/api/mypostrequest/',
'data': <QueryDict: {}>,
'method': 'POST',
'user': <User: cain>
}
I'm using the default nginx configuration, I also have a web version of this part with an "upload button" and everything is working fine, there is not errors in the .log files of nginx or supervisor and the django installation is okay, any ideas? thanks