java - Spring Boot controller with custom status codes? -
in spring boot 1.3.5 (java 8) i'd controller return custom status code , status msg. "custom" mean, status code not in org.springframework.http.httpstatus.
i know, should stick standard codes (but can't).
currently controller
httpservletresponse response . . response.setstatus(255)
i expected
java.lang.illegalargumentexception: no matching constant [255] @ org.springframework.http.httpstatus.valueof(httpstatus.java:488) @ org.springframework.test.web.servlet.result.statusresultmatchers.gethttpstatusseries(statusresultmatchers.java:139)
note, operation may successful, in case want return custom 2xx code response object (i.e. senderror doesn't help).
google says may available in springframework 4.3, have thoughts implementing (with springframework 4.2.6)?
custom http codes work on 4.2. matcher in junit fails assert response code. should work on browser.
Comments
Post a Comment