]> Cypherpunks.ru repositories - gostls13.git/commitdiff
net/http/httptest: remove unnecessary creation of http.Transport
authorZeke Lu <lvzecai@gmail.com>
Wed, 1 Nov 2023 13:47:23 +0000 (13:47 +0000)
committerDamien Neil <dneil@google.com>
Mon, 6 Nov 2023 21:16:01 +0000 (21:16 +0000)
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: 33724596bd901a05a91654f8c2df233aa6563ea6
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>
src/net/http/httptest/server.go

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