##// END OF EJS Templates
svn: Avoid chunked transfer for Subversion
johbo -
r282:5d91eb8d stable
parent child Browse files
Show More
@@ -39,10 +39,10 b' class SimpleSvnApp(object):'
39 request_headers = self._get_request_headers(environ)
39 request_headers = self._get_request_headers(environ)
40
40
41 data = environ['wsgi.input']
41 data = environ['wsgi.input']
42 # johbo: On Gunicorn, we end up with a 415 response if we pass data
42 # johbo: Avoid that we end up with sending the request in chunked
43 # to requests. I think the request is usually without payload, still
43 # transfer encoding (mainly on Gunicorn). If we know the content
44 # reading the data to be on the safe side.
44 # length, then we should transfer the payload in one request.
45 if environ['REQUEST_METHOD'] == 'MKCOL':
45 if environ['REQUEST_METHOD'] == 'MKCOL' or 'CONTENT_LENGTH' in environ:
46 data = data.read()
46 data = data.read()
47
47
48 response = requests.request(
48 response = requests.request(
@@ -178,7 +178,7 b' class TestSimpleSvnApp(object):'
178 ]
178 ]
179 request_mock.assert_called_once_with(
179 request_mock.assert_called_once_with(
180 self.environment['REQUEST_METHOD'], expected_url,
180 self.environment['REQUEST_METHOD'], expected_url,
181 data=self.wsgi_input, headers=expected_request_headers)
181 data=self.data, headers=expected_request_headers)
182 response_mock.iter_content.assert_called_once_with(chunk_size=1024)
182 response_mock.iter_content.assert_called_once_with(chunk_size=1024)
183 args, _ = start_response.call_args
183 args, _ = start_response.call_args
184 assert args[0] == '200 OK'
184 assert args[0] == '200 OK'
General Comments 0
You need to be logged in to leave comments. Login now