Skip to content

Instantly share code, notes, and snippets.

@thrawn01
Last active September 29, 2023 01:27
Show Gist options
  • Save thrawn01/37daf42e8809107fc2fe50fff4804850 to your computer and use it in GitHub Desktop.
Save thrawn01/37daf42e8809107fc2fe50fff4804850 to your computer and use it in GitHub Desktop.
client := http.Client{
Transport: &http2.Transport{
// So http2.Transport doesn't complain the URL scheme isn't 'https'
AllowHTTP: true,
// Pretend we are dialing a TLS endpoint.
// Note, we ignore the passed tls.Config
DialTLSContext: func(ctx context.Context, n, a string, _ *tls.Config) (net.Conn, error) {
var d net.Dialer
return d.DialContext(ctx, n, a)
},
},
}
resp, _ := client.Get(url)
fmt.Printf("Client Proto: %d\n", resp.ProtoMajor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment