title: How to pass raw data to post request
body: <p>I have faced some weird issue, I am sending request with Postman (using raw body) and getting correct response, but When I am making request with go, I am getting different response.</p>
  
  <p>I tried this: </p>
  
  <pre><code>url := "http://example.com"
  payload := strings.NewReader("key=value")
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("content-type", "application/x-www-form-urlencoded")
  req.Header.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36")
  req.Header.Add("cache-control", "no-cache")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)
  
  fmt.Println(res)
  fmt.Println(string(body))
  </code></pre>
  
  <p>But got wrong response, also tried using values</p>
  
  <pre><code>values := url.Values{}
  values.Add("key", "value")
  payload := strings.NewReader(values.Encode())
  </code></pre>
  
  <p>But still getting wrong response, is there a way to simulate postman's raw method in Go?</p>
  
  <p>Postman is automatically adding cookies to my request, just added Cookie header and the problem is fixed</p>