-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
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.