fix: remove logs of the request
This commit is contained in:
parent
88603810a8
commit
778188ed34
20 changed files with 94 additions and 38 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
|
@ -1378,3 +1379,36 @@ func (s *SimpleSuite) TestMuxer(c *check.C) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SimpleSuite) TestDebugLog(c *check.C) {
|
||||
s.createComposeProject(c, "base")
|
||||
|
||||
s.composeUp(c)
|
||||
defer s.composeDown(c)
|
||||
|
||||
file := s.adaptFile(c, "fixtures/simple_debug_log.toml", struct{}{})
|
||||
defer os.Remove(file)
|
||||
|
||||
cmd, output := s.cmdTraefik(withConfigFile(file))
|
||||
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
defer s.killCmd(cmd)
|
||||
|
||||
err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1*time.Second, try.BodyContains("PathPrefix(`/whoami`)"))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
req, err := http.NewRequest(http.MethodGet, "http://localhost:8000/whoami", http.NoBody)
|
||||
c.Assert(err, checker.IsNil)
|
||||
req.Header.Set("Autorization", "Bearer ThisIsABearerToken")
|
||||
|
||||
response, err := http.DefaultClient.Do(req)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(response.StatusCode, checker.Equals, http.StatusOK)
|
||||
|
||||
if regexp.MustCompile("ThisIsABearerToken").MatchReader(output) {
|
||||
c.Logf("Traefik Logs: %s", output.String())
|
||||
c.Log("Found Authorization Header in Traefik DEBUG logs")
|
||||
c.Fail()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue