-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Sending a POST request with an empty body results in a NullPointerException.
This issue exists since version 5.3.1.
Unexpected exception thrown: java.lang.NullPointerException: Parameter specified as non-null is null: method okhttp3.MediaType$Companion.parse, parameter $this$toMediaTypeOrNull
org.opentest4j.AssertionFailedError: Unexpected exception thrown: java.lang.NullPointerException: Parameter specified as non-null is null: method okhttp3.MediaType$Companion.parse, parameter $this$toMediaTypeOrNull
openapi-generator version
OpenAPI 5.4.0 and OpenAPI 5.3.1
OpenAPI declaration file content or url
see https://github.com/pg-fine/openapi-post-empty-body-bug
Generation Details
see https://github.com/pg-fine/openapi-post-empty-body-bug
Steps to reproduce
see https://github.com/pg-fine/openapi-post-empty-body-bug
Related issues/PRs
"* remove default content-type in java okhttp client" is the reason for this bug
Suggest a fix
add a default content-type or allow empty request bodies with empty content-types.
jaaufauvre, osigida, petr-bartusek, drenda, joshmalbrecht and 3 more