Skip to content

Commit

Permalink
wrong setupServer copy
Browse files Browse the repository at this point in the history
  • Loading branch information
lucix-aws committed Jun 14, 2024
1 parent 66fd84f commit 2835a32
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions private/protocol/eventstream/eventstreamtest/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package eventstreamtest
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -34,9 +35,28 @@ const (
)

func setupServer(server *httptest.Server, useH2 bool) *http.Client {
server.Start()
server.Config.TLSConfig = &tls.Config{
InsecureSkipVerify: true,
}

return nil
tr := &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
}

if useH2 {
server.Config.TLSConfig.NextProtos = []string{"h2"}
tr.TLSClientConfig.NextProtos = []string{"h2"}
tr.ForceAttemptHTTP2 = true
}
server.TLS = server.Config.TLSConfig

server.StartTLS()

return &http.Client{
Transport: tr,
}
}

// ServeEventStream provides serving EventStream messages from a HTTP server to
Expand Down

0 comments on commit 2835a32

Please sign in to comment.