tls-client
tls-client copied to clipboard
How can I enable HTTP/2?
TLS client version
v1.7.0
System information
..
Issue description
client, _ := tls_client.NewHttpClient(tls_client.NewNoopLogger(), []tls_client.HttpClientOption{
tls_client.WithCookieJar(tls_client.NewCookieJar()),
tls_client.WithClientProfile(profiles.Safari_IOS_16_0),
tls_client.WithTimeoutSeconds(500),
}...)
Steps to reproduce / Code Sample
client, _ := tls_client.NewHttpClient(tls_client.NewNoopLogger(), []tls_client.HttpClientOption{
tls_client.WithCookieJar(tls_client.NewCookieJar()),
tls_client.WithClientProfile(profiles.Safari_IOS_16_0),
tls_client.WithTimeoutSeconds(500),
}...)
req, err := http.NewRequest(c.Request.Method, requestURL, bytes.NewReader(requestBody))
client, _ := tls_client.NewHttpClient(tls_client.NewNoopLogger(), []tls_client.HttpClientOption{ tls_client.WithCookieJar(tls_client.NewCookieJar()), tls_client.WithClientProfile(profiles.Safari_IOS_16_0), tls_client.WithTimeoutSeconds(500), }...)
client.Do(req)
HTTP1/2 will be selected when the connection is created. It depends on your selected tls profile and of course the server. If both negotiate on http2 (and of course support it) it will be automatically used.