-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Content-type set to "text/plain; charset=UTF-8" for POST #87
Comments
Request Headers:
Checked with Firefox 16.0.2. |
Checked with Google Chrome and Swagger UI 1.1.3 & 1.1.4: It sends 'application/xml' as content-type - so doesn't work with REST-Endpoints only accept application/json!
With Swagger UI 1.1.2 it is also not working. "Content-Type:application/x-www-form-urlencoded; charset=UTF-8" is set for the response header. Workaround: Add a manual request header in the index.html
|
Hmm.. I checked on last snapshot and it doesn't work. But! |
I think the lines (1515-1517) in swagger-ui.js (1.1.5) are responsible for this bug: if (isFileUpload) {
obj.contentType = false;
} Source: OperationView.coffee Line: 126 obj.contentType = false if isFileUpload |
Im getting this same bug in Chrome, |
Experiencing this too: isFileUpload = $('input[type~="file"]').size != 0 does not seem to work properly in Chrome 23.0.1271.91 |
I think a couple different issues are being described here. @vbauer @facultymatt you're saying that POST is not setting the right content type? Can you please confirm you have POST enabled, as described here: https://github.com/wordnik/swagger-ui#http-methods-and-api-invocation @lradziwonowicz is this check only affecting file uploads? |
addressed the default content-type in version 1.1.7, please reopen if you still see issues. |
Still seems to be present in 1.1.7. Calling size() as a method fixes the problem: isFileUpload = $('input[type~="file"]').size() !== 0; |
Hi @chrisware, I just updated the README--it was pointing to |
@fehguy to avoid confusion, you might want to push those dist folder changes across the board. I'm not sure where more old files are hiding, but I had a horrible time with POST requests using the serverless version (https://github.com/wordnik/swagger-core/tree/master/samples/no-server) until i stumbled across this issue and updated the files with the ones in the dist folder. |
I use this
|
Have you changed the mode is set to
|
When POSTing to a REST API, the Content-Type is set to "text/plain; charset=UTF-8", not to "application/json".
The text was updated successfully, but these errors were encountered: