Description
Description
Looking at the lines
If no body and form params are defined in put or post (which is possible), the generated code looks like this:
return this.httpClient.put<any>(`${this.basePath}/some-url/${encodeURIComponent(String(id))}`, {
headers: headers,
withCredentials: this.configuration.withCredentials
});
which causes
{
headers: headers,
withCredentials: this.configuration.withCredentials
}
to be treated and sent as the body. This means a body, which isn't expected by the server, is sent and headers, which are expected, are not sent.
Swagger-codegen version
Master branch, latest commit I have is bf74e33
Related issues/PRs
This is when the bug was introduced - #6295
Suggest a fix/enhancement
I'm not sure what would be the best way to fix it. For the template it would be easiest to just have always some default body param if necessary, which would be simply null, for the Java backend code it would be nicer to solve it simply on the template, but since you need a check if it's a PATCH, PUT or POST operation, I don't see how to do it in mustache. Maybe introducing a flag like expectsBody
?