Micro optimisations.

This commit is contained in:
2023-03-31 16:00:39 +01:00
parent a5c4643a5e
commit 6a8f99f6ef
2 changed files with 17 additions and 17 deletions
+9 -9
View File
@@ -86,17 +86,17 @@ func NewConnection() *GraphQL {
endpoint := pickGraphqlEndpoint()
var httpClient *http.Client
if strings.HasPrefix(endpoint, "http://") {
// HTTP/1.1 client
httpClient = &http.Client{}
} else {
// HTTP/2 or HTTPS client
http2Transport := &http2.Transport{
AllowHTTP: true,
httpClient = &http.Client{
Transport: http.DefaultTransport,
}
} else {
tlsClientConfig := &tls.Config{}
if strings.HasPrefix(endpoint, "https://") {
http2Transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
tlsClientConfig.InsecureSkipVerify = true
}
http2Transport := &http2.Transport{
AllowHTTP: true,
TLSClientConfig: tlsClientConfig,
}
httpClient = &http.Client{
Transport: http2Transport,