title: dial tcp i/o timeout with HTTP GET request
body: <p>Running into some error, I must be overlooking something.
  How can I debug this? Dropping connections?</p>
  <p>I read the following:<br />
  <a href="https://stackoverflow.com/questions/37294052/golang-why-net-dialtimeout-get-timeout-half-of-the-time">golang - Why net.DialTimeout get timeout half of the time?</a><br />
  <a href="https://stackoverflow.com/questions/35185789/go-get-error-i-o-timeout-in-server-program">Go. Get error i/o timeout in server program</a><br />
  <a href="https://stackoverflow.com/questions/28528060/golang-get-massive-read-tcp-ipport-i-o-timeout-in-ubuntu-14-04-lts">golang get massive read tcp ip:port i/o timeout in ubuntu 14.04 LTS</a><br />
  <a href="https://stackoverflow.com/questions/53949803/locating-the-read-tcp-error-in-the-go-source-code">Locating the &quot;read tcp&quot; error in the Go source code</a><br />
  <a href="https://stackoverflow.com/questions/53950606/getting-sporadic-http-proxy-error-read-tcp-i-o-timeout-on-heroku">Getting sporadic &quot;http: proxy error: read tcp: i/o timeout&quot; on Heroku</a></p>
  <p>Error created here:
  <a href="https://github.com/golang/go/blob/b115207baf6c2decc3820ada4574ef4e5ad940ec/src/net/net.go#L179" rel="noreferrer">https://github.com/golang/go/blob/b115207baf6c2decc3820ada4574ef4e5ad940ec/src/net/net.go#L179</a></p>
  <p>Goal:
  Send a Get request to a url.<br />
  Expected result:
  return body in JSON.<br />
  Encountered problem:
  I/O timeout</p>
  <p>It works in Postman<br />
  Edit:
  I added a modified timeout...</p>
  <p>Edit2: traced error</p>
  <p>Postman request:</p>
  <pre><code>GET /v2/XRP-EUR/candles?interval=1h HTTP/1.1
  Host: api.bitvavo.com
  </code></pre>
  <p>Postman Result (1440 rows):</p>
  <pre><code>[
      [
          1609632000000,
          &quot;0.17795&quot;,
          &quot;0.17795&quot;,
          &quot;0.17541&quot;,
          &quot;0.17592&quot;,
          &quot;199399.874013&quot;
      ],
      [
          1609628400000,
          &quot;0.17937&quot;,
          &quot;0.18006&quot;,
          &quot;0.17622&quot;,
          &quot;0.17852&quot;,
          &quot;599402.631894&quot;
      ],
      [
          1609624800000,
          &quot;0.18167&quot;,
          &quot;0.18167&quot;,
          &quot;0.17724&quot;,
          &quot;0.17984&quot;,
          &quot;579217.962574&quot;
      ],.....
  </code></pre>
  <p>Code:</p>
  <pre><code>package main
  
  import (
      &quot;fmt&quot;
      &quot;net/http&quot;
      &quot;io/ioutil&quot;
      &quot;time&quot;
  )
  
  func main() {
      url := &quot;https://api.bitvavo.com/v2/XRP-EUR/candles?interval=1h&quot;
      method := &quot;GET&quot;
  
      client := &amp;http.Client {
      }
      client.Timeout = time.Second * 60
      req, err := http.NewRequest(method, url, nil)
  
      if err != nil {
          fmt.Println(err)
          return
      }
      res, err := client.Do(req)
      if err != nil {
          fmt.Println(err)
          return
      }
      defer res.Body.Close()
  
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
          fmt.Println(err)
          return
      }
      fmt.Println(string(body))
  }
  </code></pre>
  <p>result:</p>
  <pre><code>Get &quot;https://api.bitvavo.com/v2/XRP-EUR/candles?interval=1h&quot;: dial tcp 65.9.73.10:443: i/o timeout
  </code></pre>