Spring RestTemplate gives “500” error but same URL, credentails works in RestClient and Curl

后端 未结 7 1747
眼角桃花
眼角桃花 2020-12-30 03:06

An Url, Credentials works in RestClient UI as well as with Curl where as i\'m getting \"500\" error when access the same via Spring RestTemplate.

I am using the foll

7条回答
  •  时光说笑
    2020-12-30 03:32

    RestTemplate header Accept problem 
    --> accept - text/plain, application/json, */*
    
    HttpClient 4.x header Accept
    --> accept - application/json
    

    so i fixed

    HttpHeaders headers = new HttpHeaders();
    headers.add("Accept", MediaType.APPLICATION_JSON_VALUE);
    

    http://www.manning-sandbox.com/message.jspa?messageID=119733

提交回复
热议问题