You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is just a race. There's no guarantee that ListenAndServeTLS will be
running by the time client.Get runs.
init runs first, but the goroutine that it starts isn't guaranteed to start running
before TestHttps.
I bet if you add a time.Sleep at the beginning of TestHttps it "works", but that's a
hacky solution.
The better solution is to start listening first with a new net.Listener, then start a
serving goroutine (using the listener you already started), and *then* make your HTTP
request.
Or just use:
http://weekly.golang.org/pkg/net/http/httptest/#NewTLSServer
mikioh
changed the title
TLS server on a goroutine won't respond to clients on different goroutines
net/http: TLS server on a goroutine won't respond to clients on different goroutines
Jan 14, 2015
by elazarl:
The text was updated successfully, but these errors were encountered: