spring - 为什么在 Spring Resttemplate 中设置“Accept”无效
问题描述
这是我的代码:
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Collections.singletonList(MediaType.TEXT_HTML));
headers.setContentType(MediaType.TEXT_XML);
HttpEntity<String> entity = new HttpEntity<>(src, headers);
ResponseEntity<String> responseEntity = restTemplate.exchange(requestUrl, HttpMethod.POST, entity, String.class);
System.out.println(responseEntity);
为什么我的日志文件打印接受是:text/plain, application/json, application/*+json, /