HttpHeaders headers = new HttpHeaders();
headers.put("key", new ArrayList<String>(Arrays.asList("some key")));
headers.put("token", new ArrayList<String>(Arrays.asList("some token")));
HttpEntity httpEntity = new HttpEntity(headers);
ResponseEntity<String> response = restTemplate.exchange(new URI(myUrl), HttpMethod.GET, httpEntity, String.class);
当我将Google的页面作为myUrl提供时,它运行良好。但是,当我提供特定的URL(在邮递员或浏览器上正常工作)时,它将失败。
Caused by: org.springframework.web.client.HttpClientErrorException: 404 NOT FOUND
知道我在做什么错吗?
谢谢