resttemplate未将标头cookie设置为请求,得到403禁止响应

时间:2019-11-04 13:30:04

标签: cookies header resttemplate

我正在尝试如下操作,但是实际上似乎未在请求中设置标头cookie,反过来,我得到了403禁止响应。我尝试在CURL中使用相同的cookie,它工作正常。所以我认为resttemplate不会将标头Cookie设置为请求

headers.add(HttpHeaders.COOKIE,  "name:value");
        HttpEntity<BusinessPartner> requestEntity = new HttpEntity<>(businessPartner, headers);
        ResponseEntity<String> response = new RestTemplate()
                .exchange(updateUrl, HttpMethod.PUT, requestEntity, String.class);

0 个答案:

没有答案