title: HTTP Get request with Authentication header groovy
body: <p>I am trying to make a HTTP get request to a URL. I have tried the curl command and it works with my authentication, but in the groovy script I get a NULL response.</p>
  <pre><code>import org.apache.commons.httpclient.HttpClient
  import org.apache.commons.httpclient.methods.GetMethod
  
  def http = new HttpClient();
  def get = new GetMethod(&quot;https://tect-hello/cit&quot;);
  def requestHeader=get.setRequestHeader(&quot;X-Vault-Token&quot;,&quot;s.mytoken&quot;);
  println requestHeader             //NULL
  println get.getName();            //GET
  println get.getResponseBody()     //NULL
  </code></pre>
  <p>CURL command</p>
  <blockquote>
  <p>curl -H &quot;X-Vault-Token: s.mytoken&quot; -X GET https://tect-hello/cit</p>
  </blockquote>
  <p>I tried the post functionality and it worked.</p>
  <p>I am unable to find a way to pass the vault token. I tried both <code>addRequestHeader</code> and <code>setRequestHeader</code></p>