-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better handling of form data #2818
Conversation
@@ -4194,7 +4196,8 @@ public void writePropertyBack(String propertyKey, boolean value) { | |||
|
|||
protected String getContentType(RequestBody requestBody) { | |||
if (requestBody == null || requestBody.getContent() == null || requestBody.getContent().isEmpty()) { | |||
return null; | |||
LOGGER.warn("Cannot determine the content type. Default to UNKNOWN_CONTENT_TYPE."); | |||
return "UNKNOWN_CONTENT_TYPE"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fallback to a valid mime type such as application/octet-stream
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, we can definitely do that but the reason why I did this is to make it consistent with similar unknown cases in the code (e.g. https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L3131) so that users can easily grep "UNKNOWN" to identify which operations/models need to be fixed.
If later users have feedback on having a better default (e.g. application/octet-stream), we can definitely make the switch.
* master: resize lightbow logo add lightbow logo add Lightbow as sponsor (#2822) [docs] Document new templating engine, adding ability to reference templates by file to comlete the example (#2773) [JAVA][KOTLIN] fix var Naming for all uppercase with Numbers (#2794) [Documentation] Add instructions to build the javascript client module (#2806) use mvn instead of run-in-docker (#2821) Better handling of form data (#2818) [haskell-servant] Add some missing types to the generated modules (#2675)
* master: resize lightbow logo add lightbow logo add Lightbow as sponsor (#2822) [docs] Document new templating engine, adding ability to reference templates by file to comlete the example (#2773) [JAVA][KOTLIN] fix var Naming for all uppercase with Numbers (#2794) [Documentation] Add instructions to build the javascript client module (#2806) use mvn instead of run-in-docker (#2821) Better handling of form data (#2818) [haskell-servant] Add some missing types to the generated modules (#2675) Clarifies need to build project for sample output (#2819) [Elm] Bugfix .encode in modelTypeDiscriminator (#2807) Apply strict spec option to CodegenConfig instance (#2814)
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,. Default:3.4.x
,4.0.x
master
.Description of the PR
cc @OpenAPITools/generator-core-team