Skip to content

Commit 35156e8

Browse files
fix test
1 parent 92b9ebe commit 35156e8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

hug/interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,10 @@ def gather_parameters(self, request, response, api_version=None, **input_paramet
444444
input_parameters.update(request.params)
445445
if self.parse_body and request.content_length is not None:
446446
body = request.stream
447-
content_type, ct_params = parse_header(request.content_type)
447+
content_type, content_type_params = parse_header(request.content_type)
448448
body_formatter = body and self.api.http.input_format(content_type)
449449
if body_formatter:
450-
body = body_formatter(body, ct_params) if ct_params else body_formatter(body)
450+
body = body_formatter(body, content_type_params) if content_type_params else body_formatter(body)
451451
if 'body' in self.parameters:
452452
input_parameters['body'] = body
453453
if isinstance(body, dict):

tests/test_decorators.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,9 +1185,8 @@ def test_multipart_post(**kwargs):
11851185
return kwargs
11861186

11871187
with open(os.path.join(BASE_DIRECTORY, 'artwork', 'logo.png'),'rb') as logo:
1188-
preq = requests.Request('POST', 'http://localhost/', files={'logo': logo}).prepare()
1188+
prepared_request = requests.Request('POST', 'http://localhost/', files={'logo': logo}).prepare()
11891189
logo.seek(0)
11901190
output = json.loads(hug.defaults.output_format({'logo': logo.read()}).decode('utf8'))
1191-
assert hug.test.post(api, 'test_multipart_post',
1192-
body=preq.body,
1193-
headers=preq.headers).data == output
1191+
assert hug.test.post(api, 'test_multipart_post', body=prepared_request.body,
1192+
headers=prepared_request.headers).data == output

0 commit comments

Comments
 (0)