Skip to content

Commit b9ecac0

Browse files
teaguebradfitz
teague
authored andcommitted
net/http/httputil: reduced log verbosity in reverseproxy_test.go
For functions TestClonesRequestHeaders and TestReverseProxy_PanicBodyError, I made changes to update the log verbosity. Fixes #25634 Change-Id: I2a0ef70a8191cfb1a0005949345be722fb4ab62e Reviewed-on: https://go-review.googlesource.com/115296 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent b12e341 commit b9ecac0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/net/http/httputil/reverseproxy_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"net/http"
1818
"net/http/httptest"
1919
"net/url"
20+
"os"
2021
"reflect"
2122
"strconv"
2223
"strings"
@@ -748,6 +749,8 @@ func TestServeHTTPDeepCopy(t *testing.T) {
748749
// Issue 18327: verify we always do a deep copy of the Request.Header map
749750
// before any mutations.
750751
func TestClonesRequestHeaders(t *testing.T) {
752+
log.SetOutput(ioutil.Discard)
753+
defer log.SetOutput(os.Stderr)
751754
req, _ := http.NewRequest("GET", "http://foo.tld/", nil)
752755
req.RemoteAddr = "1.2.3.4:56789"
753756
rp := &ReverseProxy{
@@ -824,6 +827,8 @@ func (cc *checkCloser) Read(b []byte) (int, error) {
824827

825828
// Issue 23643: panic on body copy error
826829
func TestReverseProxy_PanicBodyError(t *testing.T) {
830+
log.SetOutput(ioutil.Discard)
831+
defer log.SetOutput(os.Stderr)
827832
backendServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
828833
out := "this call was relayed by the reverse proxy"
829834
// Coerce a wrong content length to induce io.ErrUnexpectedEOF

0 commit comments

Comments
 (0)