swagger-ui: Incorrect Accept header sent from Swagger-UI
I’ve got a java webapp where I’m doing version control via content negotiation. My method looks like:
@POST
@Consumes("application/vnd.mycompany.foo.v1+json")
@Produces("application/vnd.mycompany.bar.v1+json")
@ApiOperation(...)
@ApiResponses(...)
public Response createBar(
        @ApiParam(required = true) final Foo foo) {
    ..
}
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.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Reactions: 1
- Comments: 21 (9 by maintainers)
It hasn’t been resolved, but there’s a walkaround available - look through the forums here.
On Monday, August 17, 2015, teodora-yankova notifications@github.com wrote:
Is there any info on which version the Accept header sending is still working?
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.