使用spring cloud feign调用我的服务,当服务返回401异常时,respose.body()为null。
当我抛出异常时,throw new BadRequestException(400\xef\xbc\x8c \xe2\x80\x9cthis http code is 400\xe2\x80\x9d);我可以得到错误消息,this http code is 400通过response.body()。\n但是当我抛出异常时throw new BadRequestException(401\xef\xbc\x8c \xe2\x80\x9cthis http code is 401\xe2\x80\x9d);,response.body()为空。\n这个响应是feign.Response。
为什么当 http 代码为 401 时我无法收到此错误消息?
\n\n希望您的帮助!非常感谢!
\n