Ingress Http Gateway: Return HttpStatus

I have spring http inbound-gateway integration. I would like to return specific http status codes for different use cases. Is there a way to specify httpStatus in the response ???

I've tried with a router like excepion where each exception is a specific http status code , but I don't know how to set the status code in the response, and I don't find any help about this in the documentation.

Thank!

+3


source to share


1 answer


User a <header-enricher/>

(or other means) to put the status in the header of the org.springframework.integration.http.HttpHeaders.STATUS_CODE

reply message. (Header name "http_statusCode"

, but a constant is usually used).

The code can be either an object HttpStatus

or an integer / string with a status code that you want to return.



Please open the JARA "Documentation" question https://jira.springsource.org/browse/INT

+6


source







All Articles