-
Notifications
You must be signed in to change notification settings - Fork 6k
Error response body does not match Content-Type #12450
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
Comments
Maybe related: spring-projects/spring-framework#29626 |
I think this is intentional, but I would like this feature as well. I'm using OAuth2, and it would be great for the consistency our APIs to have 401/403 return |
Perhaps |
@osiegmar, there's something I'm not quite understanding. When I create the specified application and run the specified command, this is the result I get:
It seems like a reasonable result, what am I missing? Second, the response is created by Spring Boot's |
@jzheaux can you please share your configuration? I wonder if this is related to spring-projects/spring-boot#32212. |
@singhbaljit I copied the code posted in the issue. Can someone please post a minimal sample (for example, a GitHub repo) that reproduces the issue? |
@jzheaux You successfully reproduced the issue. The Content-Type response header has a value of |
I see, thanks for the clarification, @osiegmar. The page is generated by Spring Boot, so it would be up to them to do the content negotiation. I'm not sure if Spring Boot supports RFC 7807. I think it's clear enough now to close the issue, but if I've misunderstood and there is something more for Spring Security to do, we can reopen. |
Describe the bug
In an application (using Spring Boot 3.0.1) the response body does not match the
Content-Type
header for a 403 Forbidden response if the request contains the headerAccept: application/problem+json, application/json
:Note: I'm using the shown mime type order because of spring-projects/spring-framework#29588
To Reproduce
@Secured("ROLE_ADMIN")
)Accept: application/problem+json, application/json
Expected behavior
Content-Type
response header must reflect the actual type of the contentSample
Request:
The text was updated successfully, but these errors were encountered: