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
We would like to use custom status codes like 555 that tells the client how to process and display the response body for the user.
With the current code of AdviceTraits it is not possible.
Description
There were several issues at Spring side before to support custom status codes. Since Spring 4.1 there is a status(int) function for the ResponseEntity that can be used for custom status codes.
Expected Behavior
The following code should initiate a response with status 555:
The implementation of Custom555Status returns the code 555.
Actual Behavior
An exception is thrown:
java.lang.IllegalArgumentException: No matching constant for [555]
at org.springframework.http.HttpStatus.valueOf(HttpStatus.java:540)
at org.zalando.problem.spring.web.advice.AdviceTrait.create(AdviceTrait.java:121)
at org.zalando.problem.spring.web.advice.AdviceTrait.create(AdviceTrait.java:110)
at org.zalando.problem.spring.web.advice.AdviceTrait.create(AdviceTrait.java:105)
Possible Fix
Use responseEntity.status(int) in the AdviceTraits class and also accept only status code for logging.
Steps to Reproduce
The sample code written above.
The text was updated successfully, but these errors were encountered:
We would like to use custom status codes like 555 that tells the client how to process and display the response body for the user.
With the current code of AdviceTraits it is not possible.
Description
There were several issues at Spring side before to support custom status codes. Since Spring 4.1 there is a status(int) function for the ResponseEntity that can be used for custom status codes.
Expected Behavior
The following code should initiate a response with status 555:
The implementation of Custom555Status returns the code 555.
Actual Behavior
An exception is thrown:
Possible Fix
Use responseEntity.status(int) in the AdviceTraits class and also accept only status code for logging.
Steps to Reproduce
The sample code written above.
The text was updated successfully, but these errors were encountered: