We are using Spring Boot 1.5.9-RELEASE and spring-cloud-starter-zuul. One of the backend services we forward requests to provide non standard http status codes like 517.
The current version of zuul contains a version of the RibbonRoutingFilter which executes on the ClientHttpResponse object following call: .getStatusCode().value()
This causes an IllegalArgumentException. Since the filter requires the int value of the status code you could replace these calls by .getRawStatusCode() which do not throw an exception
Hi @ryanjbaxter @PatrikSteuer
I think the revised code should be like this:
RibbonRoutingFilter
protected void setResponse(ClientHttpResponse resp)
throws ClientException, IOException {
RequestContext.getCurrentContext().set("zuulResponse", resp);
this.helper.setResponse(resp.getRawStatusCode(),
resp.getBody() == null ? null : resp.getBody(), resp.getHeaders());
}
If you think there is no problem, I think I can submit a PR to complete this slight modification
Thanks again : )
Hi @holy12345
this looks fine for me. Furthermore you have to check the forward function within the RibbonRoutingFilter where the .getStatusCode().value() is used.
@PatrikSteuer
Yeah ! thank you so much for your suggestion : )
I think we just need to make two slight changes in the RibbonRoutingFilter class(One is in the forward() method and the other is in the setResponse() method)
In both of these methods, .getStatusCode().Value() is replaced by .getRawStatusCode()
Most helpful comment
@PatrikSteuer
Yeah ! thank you so much for your suggestion : )
I think we just need to make two slight changes in the
RibbonRoutingFilterclass(One is in theforward()method and the other is in thesetResponse()method)In both of these methods,
.getStatusCode().Value()is replaced by.getRawStatusCode()