]> Cypherpunks repositories - gostls13.git/commitdiff
net/http/httputil: reduced log verbosity in reverseproxy_test.go
authorteague <tnc1443@gmail.com>
Wed, 30 May 2018 15:35:11 +0000 (11:35 -0400)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 30 May 2018 17:30:17 +0000 (17:30 +0000)
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 <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/net/http/httputil/reverseproxy_test.go

index 1ad67562af047be468ff1f4e7ca36b8d2690a5c0..0240bfa8a616d14c2b51b8756f77fc7db8bad483 100644 (file)
@@ -17,6 +17,7 @@ import (
        "net/http"
        "net/http/httptest"
        "net/url"
+       "os"
        "reflect"
        "strconv"
        "strings"
@@ -748,6 +749,8 @@ func TestServeHTTPDeepCopy(t *testing.T) {
 // Issue 18327: verify we always do a deep copy of the Request.Header map
 // before any mutations.
 func TestClonesRequestHeaders(t *testing.T) {
+       log.SetOutput(ioutil.Discard)
+       defer log.SetOutput(os.Stderr)
        req, _ := http.NewRequest("GET", "http://foo.tld/", nil)
        req.RemoteAddr = "1.2.3.4:56789"
        rp := &ReverseProxy{
@@ -824,6 +827,8 @@ func (cc *checkCloser) Read(b []byte) (int, error) {
 
 // Issue 23643: panic on body copy error
 func TestReverseProxy_PanicBodyError(t *testing.T) {
+       log.SetOutput(ioutil.Discard)
+       defer log.SetOutput(os.Stderr)
        backendServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                out := "this call was relayed by the reverse proxy"
                // Coerce a wrong content length to induce io.ErrUnexpectedEOF