-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Angular 4+ TypeScript coge generator with HttpClient is broken if post / put / patch don't have body #6649
Labels
Milestone
Comments
@macjohnny I've just now used the latest master to generate my new client, and the issue is still there |
@pgrm I will try to create a fix and open a new PR |
@macjohnny FYI, this is how I solved it for now - apaleo@57cf9b6 (I can see that I forgot to update the comment 😉 but it seems to be working) |
Hi @pgrm @macjohnny |
@topce I'll submit a PR later today |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Looking at the lines
swagger-codegen/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache
Lines 241 to 252 in f3e19e0
If no body and form params are defined in put or post (which is possible), the generated code looks like this:
which causes
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
?The text was updated successfully, but these errors were encountered: