Created
January 23, 2020 20:31
-
-
Save ry4nz/1900ab11b186f77bdeefa50d712ab17b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated by curl-to-Go: https://mholt.github.io/curl-to-go | |
// TODO: This is insecure; use only in dev environments. | |
tr := &http.Transport{ | |
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, | |
} | |
client := &http.Client{Transport: tr} | |
req, err := http.NewRequest("GET", "https://api.pro.coinbase.com/products", nil) | |
if err != nil { | |
// handle err | |
} | |
resp, err := client.Do(req) | |
if err != nil { | |
// handle err | |
} | |
defer resp.Body.Close() | |
body, _ := ioutil.ReadAll(resp.Body) | |
var products []Product | |
json.Unmarshal(body, &products) | |
fmt.Println(products) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment