我从邮递员控制台获得以下内容
logger.info("generating new token from "+URL);
expritation = new Date();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
MultiValueMap<String, String> map= new LinkedMultiValueMap<>();
map.add("userUid", userUid);
map.add("appUid", appUid);
map.add("ttl", ttl);
restTemplate.getInterceptors().add(new BasicAuthorizationInterceptor(WsLogin, WsPassword));
ResponseEntity<String> response = restTemplate.postForEntity(URL, map , String.class);
return response.getBody();
我可以在 postman 中看到响应正文,但是 response.getBody() 在 java 代码中是空的。
谁能向我解释为什么会这样。
答案 0 :(得分:0)
您的意思是您在 Postman 中看到了响应正文,但在您的编中没有看到?您是否尝试在从方法返回之前调试打印响应值?