title: setting header for get erquest with RestTemplate
body: <p>I have the following curl request :</p>
  <pre><code>curl -k -X GET &quot;URL?searchText=test&quot; -H &quot;accept: application/json&quot; -H &quot;X-API-TOKEN: &quot;Token&quot;
  </code></pre>
  <p>and i want to consume this WS using Spring so i used the following piece of code:</p>
  <pre><code>            HttpHeaders headers = new HttpHeaders();
              headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
              headers.add(&quot;X-API-TOKEN&quot;,&quot;Token&quot;);
              HttpEntity&lt;String&gt; entity = new HttpEntity&lt;&gt;(&quot;body&quot;, headers);
              ResponseEntity&lt;String&gt;response = 
              restTemplate.exchange(URL, HttpMethod.GET, entity,String.class);
  </code></pre>
  <p>But it doesn't seem to work and it shows this error:
  <a href="https://i.stack.imgur.com/irngD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/irngD.png" alt="enter image description here" /></a></p>
  <p>Can anyone showm where i am supposed to do to fix that</p>