title: How to get response with JWT in Golang
body: <p>I'm trying get the response from an API that uses JSON Web token, I need use the header : {
    Authorization: "Bearer token"
  }
  But I would like to keep the timeout of the http.Client that I'm using. How could I do it?</p>
  
  <pre><code>    var myClient = &amp;http.Client{Timeout: 10 * time.Second}
  
  func getJson(url string, target interface{}) error {
      r, err := myClient.Get(url)
      if err != nil {
          return err
      }
      defer r.Body.Close()
  
      return json.NewDecoder(r.Body).Decode(target)
  }
  </code></pre>