[英]How can I check the http response status code in a Spring Interceptor?
It seems that the HttpServletResponse
parameter passed to HandlerInterceptor#postHandle
is write only: there is no getStatus()
method there. 似乎传递给HandlerInterceptor#postHandle
的HttpServletResponse
参数是只写的:那里没有getStatus()
方法。
Any idea about how to find out which HttpStatus
was set after the request? 有关如何找出HttpStatus
后设置的HttpStatus
任何想法?
Do you need this for unit testing? 你需要这个用于单元测试吗? If so, just use MockHttpServletResponse, in which getStatus() is defined. 如果是这样,只需使用MockHttpServletResponse,其中定义了getStatus()。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.