Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

2.8.0 /swagger-resource/configuration/ui does not set Accept header properly #2461

Copy link
Copy link
@OverDrone

Description

@OverDrone
Issue body actions

Hello!
springfox-swagger-ui-2.8.0\META-INF\resources\webjars\springfox-swagger-ui\springfox.js has the following code:
const configUIResponse = await fetch(baseUrl + "/swagger-resources/configuration/ui");
browser translates into HTTP request with request header Accept=/.
Swagger controller which handles "/swagger-resources/configuration/ui" does not define "produces".
My Web MVC configuration uses default produces=text/html (if set to application/json then other swagger static resources stop working).
Tomcat replies to /swagger-resources/configuration/ui having Accept=/ with 401 or 406 (depends on tomcat version).
Problem is that spring can't select representation for returned object in this configuration. It can't present it in default representation (test/html) and client didn't provide any hints (accept=/)
Previous version 2.7.0 used different javascript call $.ajax(...) which by default sets Accept="application/json,..."

Possible fix:
include content type in request:
fetch("...",
{
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
...
})

I have 18.3.1.1232 Yandex browser.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.