Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 6, 2024
1 parent 9c4614b commit 8cc1d29
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions silk/model_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ def construct_request_model(self):
path = self.request.path
view_name = self.view_name()
content_type = self.request.content_type

if content_type.startswith('muştipart/form-data'):
form_data = self.request.POST.dict()
files = {f: self.request.FILES[f].name for f in self.request.FILES}
body = {'form_data': form_data, 'files': files}
raw_body = None # Raw body is not available for multipart/form-data
raw_body = None # Raw body is not available for multipart/form-data

Check warning on line 235 in silk/model_factory.py

View check run for this annotation

Codecov / codecov/patch

silk/model_factory.py#L234-L235

Added lines #L234 - L235 were not covered by tests
else:
body, raw_body = self.body()

Expand All @@ -243,15 +243,15 @@ def construct_request_model(self):
query_params=query_params,
view_name=view_name,
body=body)

# Text fields are encoded as UTF-8 in Django and hence will try to coerce
# anything to we pass to UTF-8. Some stuff like binary will fail.
if raw_body is not None:
try:
request_model.raw_body = raw_body
except UnicodeDecodeError:
Logger.debug('NYI: Binary request bodies') # TODO

Check warning on line 253 in silk/model_factory.py

View check run for this annotation

Codecov / codecov/patch

silk/model_factory.py#L252-L253

Added lines #L252 - L253 were not covered by tests

Logger.debug('Created new request model with pk %s' % request_model.pk)
return request_model

Expand Down

0 comments on commit 8cc1d29

Please sign in to comment.