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

pass empty json {} on post #326

Closed
fehguy opened this issue Mar 27, 2015 · 3 comments
Closed

pass empty json {} on post #326

fehguy opened this issue Mar 27, 2015 · 3 comments
Milestone

Comments

@fehguy
Copy link
Contributor

fehguy commented Mar 27, 2015

from swagger-api/swagger-ui#873 we must pass either nothing or an empty JSON when posting to an operation and specifying content-type application/json

@saadmufti
Copy link

The original issue was actually about surrounding an enum with quotes when used as a POST body parameter and the content-type is application/json

@fehguy
Copy link
Contributor Author

fehguy commented May 8, 2015

OK digging into this more, here's some feedback.

Currently the content-type is NOT set if there is no body passed in the request. This is good and bad--namely it will not set Content-Type to application/json if you don't pass an object. The bad is that because the content type isn't set, the server has to guess. And depending on the server implementation, this is potentially a problem.

First we need to pass Content-Type regardless of presence of a body. Then we can detect that it's application/json and set it to an empty object.

@fehguy
Copy link
Contributor Author

fehguy commented May 8, 2015

see a6b2142

@fehguy fehguy closed this as completed May 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants