title: authenticated http client requests from golang
body: <p>I have the following code:</p>
  
  <pre class="lang-golang prettyprint-override"><code>client := &amp;http.Client{}
  
  /* Authenticate */
  req, err := http.NewRequest("GET", "http://164.99.113.32/Authenticate", nil)
  req.SetBasicAuth("&lt;username&gt;","&lt;password&gt;")
  resp, err := client.Do(req)
  if err != nil {
      fmt.Printf("Error : %s", err)
  }
  
  /* Get Details */
  req.URL, _ = url.Parse("http://164.99.113.32/Details")
  resp, err = client.Do(req)
  if err != nil {
      fmt.Printf("Error : %s", err)
  }
  </code></pre>
  
  <p>Now, the second http call is failing with a 401 access-denied error. A different REST client (a firefox plugin) correctly gets the details from the server, so I know that nothing is wrong on the server side. Do I need to pass some kind of session string or something that we got in the previous request ?</p>