Spring REST模板
我如何更正询问?只返回200个OK状态,没有身体 我的代码:Spring REST模板,spring,rest,http-headers,Spring,Rest,Http Headers,我如何更正询问?只返回200个OK状态,没有身体 我的代码: HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", sessionId); HttpEntity<String> entity = new HttpEntity<String>("parameters", headers); ResponseEntity<
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", sessionId);
HttpEntity<String> entity = new HttpEntity<String>("parameters",
headers);
ResponseEntity<String> result = restTemplate.exchange(url,
HttpMethod.POST, entity , String.class);
HttpHeaders=newhttpheaders();
标题。添加(“授权”,sessionId);
HttpEntity=新的HttpEntity(“参数”,
标题);
ResponseEntity结果=restTemplate.exchange(url,
HttpMethod.POST,实体,String.class);
错误:
org.springframework.web.client.RestClientException:无法提取响应:未找到内容类型
如何解决此问题?我了解如何使其成为HttpStatus HttpStatus=restTemplate.exchange(url、HttpMethod.POST、getEntity(sessionId)、null)。getStatusCode();