title: Get all the headers of HTTP response and send it back in next HTTP request
body: <p><strong>Go version: go1.8.1 windows/amd64</strong></p>
  
  <p>Sample code for HTTP request is:</p>
  
  <pre><code>func (c *Client) RoundTripSoap12(action string, in, out Message) error {
      fmt.Println("****************************************************************")
      headerFunc := func(r *http.Request) {
          r.Header.Add("Content-Type", fmt.Sprintf("text/xml; charset=utf-8"))
          r.Header.Add("SOAPAction", fmt.Sprintf(action))
          r.Cookies()
      }
      return doRoundTrip(c, headerFunc, in, out)
  }
  
  func doRoundTrip(c *Client, setHeaders func(*http.Request), in, out Message) error {
      req := &amp;Envelope{
          EnvelopeAttr: c.Envelope,
          NSAttr:       c.Namespace,
          Header:       c.Header,
          Body:         Body{Message: in},
      }
  
      if req.EnvelopeAttr == "" {
          req.EnvelopeAttr = "http://schemas.xmlsoap.org/soap/envelope/"
      }
      if req.NSAttr == "" {
          req.NSAttr = c.URL
      }
      var b bytes.Buffer
      err := xml.NewEncoder(&amp;b).Encode(req)
      if err != nil {
          return err
      }
      cli := c.Config
      if cli == nil {
          cli = http.DefaultClient
      }
      r, err := http.NewRequest("POST", c.URL, &amp;b)
      if err != nil {
          return err
      }
      setHeaders(r)
      if c.Pre != nil {
          c.Pre(r)
      }
      fmt.Println("*************", r)
      resp, err := cli.Do(r)
      if err != nil {
          fmt.Println("error occured is as follows ", err)
          return err
      }
      fmt.Println("response headers are: ", resp.Header.Get("sprequestguid"))
      defer resp.Body.Close()
      if resp.StatusCode != http.StatusOK {
          // read only the first Mb of the body in error case
          limReader := io.LimitReader(resp.Body, 1024*1024)
          body, _ := ioutil.ReadAll(limReader)
          return fmt.Errorf("%q: %q", resp.Status, body)
      }
      return xml.NewDecoder(resp.Body).Decode(out)
  </code></pre>
  
  <p>I will call the <code>RoundTripSoap12</code> function on the corresponding HTTP client.
  When I send a request for the first time I will be getting some headers in the HTTP response, so these HTTP response headers should be sent as-is in my next HTTP request.</p>