Skip to content
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

generated get calls include body by default #213

Open
Malchia7 opened this issue Mar 8, 2018 · 3 comments
Open

generated get calls include body by default #213

Malchia7 opened this issue Mar 8, 2018 · 3 comments

Comments

@Malchia7
Copy link

Malchia7 commented Mar 8, 2018

So I was generating code to work with the EVE Online api and was getting bad requests returned by the server.

Dug into it and it was because the generated code included empty but non-null bodies in all requests and the server was rejecting them. Presumably their server is just being more strict than the HTTP spec which allows for GET to have a body that would be ignored.

Is it worth adding an option to codegen that would tell the templates to not include an empty body on verbs like GET/DELETE? is there a reason not to? I have this half-implemented (template modified, but no opt) and would be happy to submit a PR if its something desired.

@ksherard
Copy link

ksherard commented Mar 8, 2018

I was just dealing with this today(2nd time this year). It's painful enough to troubleshoot that I hope we can get a fix for this, it looks like they are lacking contributors right now: #167

EDIT:

GET, DELETE and HEAD are no longer allowed to have request body because it does not have defined semantics as per RFC 7231.
https://swagger.io/docs/specification/describing-request-body/

@oliverhr
Copy link

@duffman03 accordingly to what you mention in the edition added to your comment, this issue should be marked as closed?

@ksherard
Copy link

Actually my edit shows that swagger codegen is actually out of spec now. Previously it was tolerable to include empty bodies in those requests, but now its agaisnt spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants