Skip to content

Commit

Permalink
make the falcon file test pass, but for a price
Browse files Browse the repository at this point in the history
  • Loading branch information
yedpodtrzitko committed Jun 26, 2022
1 parent 05b0d98 commit d6c4e74
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion spectree/plugins/falcon_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ def request_validation(self, req, query, json, form, headers, cookies):
media = None
req.context.json = json.parse_obj(media)
if form:
req_form = {x.name: x for x in req.get_media()}
# TODO - possible to pass the BodyPart here?
# req_form = {x.name: x for x in req.get_media()}
req_form = {x.name: x.stream.read() for x in req.get_media()}
req.context.form = form.parse_obj(req_form)

def validate(
Expand Down
4 changes: 3 additions & 1 deletion tests/test_plugin_falcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ class FileUploadView:
)
def on_post(self, req, resp, form: FormFileUpload):
assert form.file
file_content = form.file.stream.read()
# TODO - pass the BodyPart here?
# file_content = form.file.stream.read()
file_content = form.file
resp.media = {"file": file_content.decode("utf-8")}


Expand Down

0 comments on commit d6c4e74

Please sign in to comment.