-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Incorrect Accept header sent from Swagger-UI #485
Comments
Hi, this was broken. It has been fixed in swagger-js 2.0.34, and swagger-ui 2.0.19. Please try that out, and reopen if you see an issue. |
I updated to the most recent versions (swagger-js 2.0.36, swagger-ui.js 2.0.21, swagger-jaxrs_2.10 1.3.7). I'm still having problems. Swagger-UI is now displaying
I tried the query under firebug and I'm seeing this message in the console:
The headers appear to be going up correctly:
I see this in my Jersey log files:
When I use cURL to hit the url directly, I get a 200 and my expected data back. |
Is there any info on which version the Accept header sending is still working? |
Have you tried master? I know of no open issues for content negotiation on it
|
please use swagger-js 2.0.38 and reopen if you're having issues still. https://raw.githubusercontent.com/wordnik/swagger-js/master/lib/swagger.js |
Seems the issue is back in : |
@okigan - can you give more information about your use case? in my test it seems to work fine. |
That's not really related to the As for describing different models per content-type, it is currently not possible. You can follow this issue - OAI/OpenAPI-Specification#146. |
I bumped into the same problem. Swagger-ui keeps setting the Accept:application/json. |
@ivan-golubev - can you share your Swagger definition? |
OK, here is the swagger.json : {
"swagger": "2.0",
"info": {
"description": "This is a sample documentation.",
"version": "1.0.0",
"title": "documentation",
"contact": {
"email": "apiteam@wordnik.com"
}
},
"host": "localhost:8080",
"basePath": "/",
"schemes": [
"http"
],
"paths": {
"/users": {
"post": {
"summary": "Create profile",
"description": "Authenticate user with either Facebook id and create a new profile for him.",
"operationId": "createProfile",
"consumes": [
"application/x-www-form-urlencoded"
],
"produces": [
"application/xml; charset=UTF-8"
],
"parameters": [
{
"in": "header",
"name": "auth_method",
"description": "facebook",
"default": "facebook",
"required": true,
"type": "string"
},
{
"in": "formData",
"name": "application",
"description": "none",
"required": true,
"default": "facebook",
"type": "string"
}
],
"responses": {
"405": {
"description": "Invalid input"
}
}
}
}
}
} |
@ivan-golubev - there indeed seems to be an issue there. Can you please open a new ticket with the details? |
It hasn't been resolved, but there's a walkaround available - look through On Monday, August 17, 2015, teodora-yankova notifications@github.com
|
I having same problem: I am requesting DELETE with formData, which is requested not as api requires (MediaType.APPLICATION_FORM_URLENCODED) but UI requests MediaType.APPLICATION_JSON. This is completely wrong |
Verified working in master |
Hi @fehguy, is it new SWAGGER-UI ? and also my DELETE problem mentioned above working ? thx |
Yes I have just confirmed. Please try and post back. |
Actually the workaround for this to include the response value like - |
I am having this same issue and have been trying to resolve it from last 24 hours. Even though I specifically mentioned "consumes:["application/xml"]" still the requests go as "Accept: Application/json". Our API endpoint returns an XML response back and because of this I am getting a 0 response code and no content - response body. Our configuration is Swagger 2.0 |
I've got a java webapp where I'm doing version control via content negotiation. My method looks like:
On the UI, for Parameter Content Type, I select "vnd.mycompany.foo.v1+json". When I [Try it out!], I get back a 406 Not Acceptable. These are the headers that go out:
Accept: application/json
Content-Type: application/vnd.mycompany.foo.v1+json; charset=UTF-8
So it's not surprising that I'm getting a 406, because my response type doesn't match the accept header. I asked on the google group (https://groups.google.com/forum/#!topic/swagger-swaggersocket/NCQ3ZP7RV40), and was told I should report this as a bug.
I just grabbed the latest build from Download ZIP on the homepage and still see the issue.
The text was updated successfully, but these errors were encountered: