1
0
mirror of https://github.com/labstack/echo.git synced 2025-07-03 00:56:59 +02:00

Some work on logger middleware

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2016-03-18 22:02:10 -07:00
parent 4a86175a32
commit 830b4eff3f
2 changed files with 14 additions and 5 deletions

View File

@ -65,17 +65,17 @@ func TestLoggerIPAddress(t *testing.T) {
// With X-Real-IP
req.Header().Add(echo.XRealIP, ip)
h.Handle(c)
assert.Contains(t, buf.String(), ip)
assert.Contains(t, ip, buf.String())
// With X-Forwarded-For
buf.Reset()
req.Header().Del(echo.XRealIP)
req.Header().Add(echo.XForwardedFor, ip)
h.Handle(c)
assert.Contains(t, buf.String(), ip)
assert.Contains(t, ip, buf.String())
// with req.RemoteAddr
buf.Reset()
h.Handle(c)
assert.Contains(t, buf.String(), ip)
assert.Contains(t, ip, buf.String())
}