Skip to content

Instantly share code, notes, and snippets.

@jangaraj jangaraj/main.go Secret

Created Jan 21, 2019
Embed
What would you like to do?
package main
import (
"crypto/tls"
"fmt"
"context"
"gopkg.in/resty.v1"
"golang.org/x/oauth2"
)
func main() {
conf := &oauth2.Config{}
token := &oauth2.Token{
AccessToken: "access token here",
TokenType: "bearer",
}
client := conf.Client(context.Background(), token)
rc := resty.NewWithClient(client)
rc.SetDebug(true)
rc.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true})
resp, err := rc.R().Get("https://untrusted-root.badssl.com/")
if err != nil {
fmt.Println("ERROR: " + err.Error())
} else {
fmt.Println("Response: " + resp.String())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.