[Python] remove default content-type in the request#10782
[Python] remove default content-type in the request#10782wing328 merged 11 commits intoOpenAPITools:masterfrom
Conversation
|
Can you add a test that checks that 1 or two content types are set when they are included in the spec? |
Sure. Let me add some tests. I think we cannot let the user to specific content type right now. It defaults to use the first one. Maybe we can create another issue for this? |
|
@spacether openapi-generator/samples/client/petstore/python/tests/test_api_client.py Lines 104 to 123 in 3f3f837 |
|
This PR and #10686 (review) are both seeking to solve the same problem |
| :return: Content-Type (e.g. application/json). | ||
| """ | ||
| if not content_types: | ||
| return 'application/json' |
There was a problem hiding this comment.
I am concerned that this could be a breaking change for servers/client that depended upon this functionality.
How about adding a generator argument useJsonAsDefaultContentType and default it to True.
With that we could put your PR in a patch release.
If you want to default it to False, then this will need to be released as a minor release because it would be a breaking change with a fallback.
There was a problem hiding this comment.
I am concerned that this could be a breaking change for servers/client that depended upon this functionality.
How about adding a generator argument useJsonAsDefaultContentType and default it to True.
We've done something similar in other generators (e.g. Ruby) to remove such default behaviour (which was added before I worked on this project). No complains so far.
Thank you for adding those tests |
|
@kevchentw can you please resolve the merge conflicts when you've time and then PM me via Slack? |
013f0c5 to
90927af
Compare
Before this fix, the content-type of the request defaults to "application/json".
With this fix, we no longer set such default.
fix #8116, relate to #10769
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.xcc @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)