-
-
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)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
When a HTTP message digest needs to be calculated for inclusion in a HTTP signature, the serializeToString() helper function is invoked to serialize the HTTP body, then that serialized value is used to calculate a cryptographic hash of the body, which is set in the Digest header. There are several use cases:
- The body is not set (
objargument isnull). For example, HTTP GET requests must have an empty body. - The body is set to the empty string. For example a HTTP POST request where the body is the empty string.
- The body is the JSON value
null. For example, a HTTP POST request body may contain the JSONnullvalue. - The body is the JSON string
"null". For example, a HTTP POST request body may contain the JSON"null"value. - The body is some other non-null value.
For use case (1), the serializeToString() function incorrectly returns the String null. Instead the function should return the empty string "". Note: in the case of HTTP GET, the isBodyNullable argument is false and the obj argument is null.
openapi-generator version
master July 15 2020
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix
I had opened a PR earlier: #6634, it was properly handling the HTTP GET case, but the code has diverged since then.