hmmm000 最近的时间轴更新
hmmm000

hmmm000

V2EX 第 583310 号会员,加入于 2022-05-30 14:49:02 +08:00
hmmm000 最近回复了
2023-10-24 20:00:40 +08:00
回复了 RedBeanIce 创建的主题 Java Apache HttpClient 进行 Post 请求 异常问题( Java 对接 walmart mp)
@RedBeanIce
String personResultAsJsonStr = null;
try {
personResultAsJsonStr = restTemplate.postForObject(url, request, String.class);

catch (HttpStatusCodeException e) {
//你要的响应体
System.out.println(e.getResponseBodyAsString());
}
2023-10-24 18:18:12 +08:00
回复了 RedBeanIce 创建的主题 Java Apache HttpClient 进行 Post 请求 异常问题( Java 对接 walmart mp)
resttemplate 可以通过 catch HttpStatusCodeException ,用 getResponseBodyAsString 方法获取非 200 返回的响应体。httpclient 不清楚。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   945 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 22:11 · PVG 06:11 · LAX 15:11 · JFK 18:11
Developed with CodeLauncher
♥ Do have faith in what you're doing.