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:
@ -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())
|
||||
}
|
||||
|
Reference in New Issue
Block a user