Last active
September 29, 2023 01:27
-
-
Save thrawn01/37daf42e8809107fc2fe50fff4804850 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
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