You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
2.8.0 /swagger-resource/configuration/ui does not set Accept header properly #2461
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'
},
...
})
Activity
dilipkrish commentedon Jun 7, 2018
@OverDrone that is a great suggestion. Would you be able to create a PR?
Added accept and content-type headers