[Python] Add Support for Content-Disposition Header without filename - #11055
Conversation
|
Thank you for this PR. It looks great but you have not included any tests of it. |
The test should be updated now, thanks for letting me know! |
|
@wing328 Is there a chance this can be looked at soon? It's blocking for our development. Please let me know if anything else needs to be added from my end. |
|
Can you please rebase on master and regenerate your samples? Samples are not up to date. |
@spacether did that merge with master accomplish this? Or is a true rebase required? |
|
@spacether I'm attempting to keep my branches up to date with the master, but this most recent time, the bitrise test failed due to it not being able to resolve dependencies for |
|
LGTM. Thanks for the PR. |
Generated python sdks previously threw an AttributeError when attempting to deserialize a file in an HTTP response body if there was no
filename=attribute in the Content-Disposition header.model_utils.mustachehas been updated to include support for responses with no filename in this header. Thedeserialize_filefunction now validates the type of the regex search before assigning the filename to the regex group. The regex search has been given a flag to allow it to search case-insensitively. If no filename is present, one is generated using theuuidlibrary.This can be validated by hitting the endpoint in the FastAPI app below. Removing
; filename="test.png"from the Content-Disposition header will cause the temporary file to be nameddefault_<uuid>. With the filename populated, the filename will betest.png.PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master(5.3.0),6.0.x@taxpon (2017/07) @frol (2017/07) @mbohlool (2017/07) @cbornet (2017/09) @kenjones-cisco (2017/11) @tomplus (2018/10) @Jyhess (2019/01) @arun-nalla (2019/11) @spacether (2019/11)