mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-13 00:48:37 +00:00
fixup! Add support of h2c over cleartext http
This commit is contained in:
@@ -75,15 +75,20 @@ func (suite *RequestCompressionTestSuite) TestRequestCompression() {
|
||||
httpClient := client.createHttpClient()
|
||||
assert.NotNil(httpClient, "HTTP client should be created")
|
||||
|
||||
// Verify transport settings - now using HTTP/2 for all endpoints
|
||||
transport, ok := httpClient.Transport.(*http2.Transport)
|
||||
assert.True(ok, "Should be http2.Transport for all endpoints (h2c for http://, TLS for https://)")
|
||||
if ok {
|
||||
assert.True(transport.DisableCompression, "DisableCompression should be true to prevent trailing garbage")
|
||||
if strings.HasPrefix(endpoint, "http://") {
|
||||
assert.True(transport.AllowHTTP, "AllowHTTP should be true for h2c (HTTP/2 Cleartext)")
|
||||
assert.Nil(transport.TLSClientConfig, "TLSClientConfig should be nil for http:// endpoints")
|
||||
} else {
|
||||
// Verify transport settings based on protocol
|
||||
if strings.HasPrefix(endpoint, "http://") {
|
||||
// HTTP/1.1 transport for http:// (h2c rarely supported)
|
||||
transport, ok := httpClient.Transport.(*http.Transport)
|
||||
assert.True(ok, "Should be http.Transport for http:// endpoints")
|
||||
if ok {
|
||||
assert.True(transport.DisableCompression, "DisableCompression should be true to prevent trailing garbage")
|
||||
}
|
||||
} else {
|
||||
// HTTP/2 transport for https://
|
||||
transport, ok := httpClient.Transport.(*http2.Transport)
|
||||
assert.True(ok, "Should be http2.Transport for https:// endpoints")
|
||||
if ok {
|
||||
assert.True(transport.DisableCompression, "DisableCompression should be true to prevent trailing garbage")
|
||||
assert.True(transport.AllowHTTP, "AllowHTTP should be true")
|
||||
assert.NotNil(transport.TLSClientConfig, "TLSClientConfig should be set for https:// endpoints")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user