V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
V2EX  ›  hmmm000  ›  全部回复第 1 页 / 共 1 页
回复总数  2
@RedBeanIce
String personResultAsJsonStr = null;
try {
personResultAsJsonStr = restTemplate.postForObject(url, request, String.class);

catch (HttpStatusCodeException e) {
//你要的响应体
System.out.println(e.getResponseBodyAsString());
}
resttemplate 可以通过 catch HttpStatusCodeException ,用 getResponseBodyAsString 方法获取非 200 返回的响应体。httpclient 不清楚。
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2981 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 09:32 · PVG 17:32 · LAX 02:32 · JFK 05:32
♥ Do have faith in what you're doing.