svn: Avoid chunked transfer for Subversion

This commit is contained in:
Johannes Bornhold 2016-06-21 17:12:28 +02:00
parent a10185d584
commit 8a9ef796fc
2 changed files with 5 additions and 5 deletions

View file

@ -39,10 +39,10 @@ class SimpleSvnApp(object):
request_headers = self._get_request_headers(environ)
data = environ['wsgi.input']
# johbo: On Gunicorn, we end up with a 415 response if we pass data
# to requests. I think the request is usually without payload, still
# reading the data to be on the safe side.
if environ['REQUEST_METHOD'] == 'MKCOL':
# johbo: Avoid that we end up with sending the request in chunked
# transfer encoding (mainly on Gunicorn). If we know the content
# length, then we should transfer the payload in one request.
if environ['REQUEST_METHOD'] == 'MKCOL' or 'CONTENT_LENGTH' in environ:
data = data.read()
response = requests.request(

View file

@ -178,7 +178,7 @@ class TestSimpleSvnApp(object):
]
request_mock.assert_called_once_with(
self.environment['REQUEST_METHOD'], expected_url,
data=self.wsgi_input, headers=expected_request_headers)
data=self.data, headers=expected_request_headers)
response_mock.iter_content.assert_called_once_with(chunk_size=1024)
args, _ = start_response.call_args
assert args[0] == '200 OK'