如何在 Spring 拦截器中检查 http 响应状态代码?
传递给 HandlerInterceptor#postHandle 的 HttpServletResponse 参数似乎是只写的:那里没有 getStatus() 方法。
知道如何找出请求后设置的 HttpStatus
吗?
It seems that the HttpServletResponse
parameter passed to HandlerInterceptor#postHandle
is write only: there is no getStatus()
method there.
Any idea about how to find out which HttpStatus
was set after the request?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要这个来进行单元测试吗?如果是这样,只需使用 MockHttpServletResponse,其中定义了 getStatus() 。
Do you need this for unit testing? If so, just use MockHttpServletResponse, in which getStatus() is defined.