0

I configure the interceptor in custom WebMvcConfigurer.

public class RegisterInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        responseMsg(response,ResponseEnum.REGISTER_UN_AUTHORIZATION);
        return false;
    }
    public void responseMsg(HttpServletResponse response,ResponseEnum responseEnum) throws Exception{
        response.setContentType("application/json;charset=utf-8");
        response.setStatus(responseEnum.getCode());
        ReturnMsg msg = new ReturnMsg(responseEnum);
        ServletOutputStream out = response.getOutputStream();
        out.write(new ObjectMapper().writeValueAsString(msg).getBytes());
        out.flush();
        out.close();
    }
}

I want to repsond to messages,but defeated postman : Parse Error: Response overflow

wangs
  • 1

1 Answers1

0

I doubt that your customed response code (ResponseEnum.REGISTER_UN_AUTHORIZATION) is too large. And that large response code is not expected by the postman. Check your ResponseEnum.REGISTER_UN_AUTHORIZATION code, it should comply with HTTP status code.

RedEyes
  • 3
  • 3