Skip to content
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

@ExceptionHandler returns 406 when Controller method returns Mono<String> and exception handler returns Mono<Map<String,String>> and Controller method returns Mono.error #15691

Closed
bidadh opened this issue Jan 12, 2019 · 1 comment
Assignees
Labels
status: invalid An issue that we don't feel is valid

Comments

@bidadh
Copy link

bidadh commented Jan 12, 2019

Hi,

I've created this repo: https://github.com/bidadh/exception-handling-issue to demonstrate the issue.

You can simply run mvn spring-boot:run and try different http-reques files in the project.

if you try:
GET http://localhost:8080/mono-error-long

or any other requests you'll receive the correct response:

GET http://localhost:8080/mono-error-long

HTTP/1.1 409 Conflict
Content-Type: application/json;charset=UTF-8
Content-Length: 74

{
    "message": "Error Happened",
    "req": "http://localhost:8080/mono-error-long"
}

However, if you run the following:
GET http://localhost:8080/mono-error-string-map

you'll receive this response:

HTTP/1.1 406 Not Acceptable
Content-Type: application/json;charset=UTF-8
Content-Length: 167

{
    "timestamp": "2019-01-12T15:45:47.734+0000",
    "path": "/mono-error-string-map",
    "status": 406,
    "error": "Not Acceptable",
    "message": "Could not find acceptable representation"

Thanks,
Arthur

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 14, 2019
@bclozel bclozel self-assigned this Feb 18, 2019
@bclozel bclozel added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 21, 2019
@bclozel
Copy link
Member

bclozel commented Feb 21, 2019

Hi @bidadh

Sorry for the late reply. This is actually a bug in Spring Framework and I've created spring-projects/spring-framework#22452 to address it. I'm marking this issue as invalid because it belongs to another project, but your report and especially repro application were really useful.

Thanks for your contribution!

@bclozel bclozel closed this as completed Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants