net/http/httptest: remove unnecessary creation of http.Transport

In (*Server).StartTLS, it's unnecessary to create an http.Client
with a Transport, because a new one will be created with the
TLSClientConfig later.

Change-Id: I086e28717e9739787529006c3f0296c8224cd790
GitHub-Last-Rev: 33724596bd
GitHub-Pull-Request: golang/go#60124
Reviewed-on: https://go-review.googlesource.com/c/go/+/494355
Run-TryBot: t hepudds <thepudds1460@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
This commit is contained in:
Zeke Lu 2023-11-01 13:47:23 +00:00 committed by Damien Neil
parent be26ae18ca
commit f5ec2e46d9
1 changed files with 1 additions and 1 deletions

View File

@ -144,7 +144,7 @@ func (s *Server) StartTLS() {
panic("Server already started") panic("Server already started")
} }
if s.client == nil { if s.client == nil {
s.client = &http.Client{Transport: &http.Transport{}} s.client = &http.Client{}
} }
cert, err := tls.X509KeyPair(testcert.LocalhostCert, testcert.LocalhostKey) cert, err := tls.X509KeyPair(testcert.LocalhostCert, testcert.LocalhostKey)
if err != nil { if err != nil {