From def26e1c757815bee024c1181ea1bb66c399156b Mon Sep 17 00:00:00 2001 From: Smolyakov Date: Sun, 1 Sep 2019 16:54:22 +0300 Subject: Add case in test --- service/http/handler_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'service') diff --git a/service/http/handler_test.go b/service/http/handler_test.go index 64f536bf..e29b76ac 100644 --- a/service/http/handler_test.go +++ b/service/http/handler_test.go @@ -1346,6 +1346,14 @@ func TestHandler_XForwardedFor(t *testing.T) { assert.NoError(t, err) assert.Equal(t, 200, r.StatusCode) assert.Equal(t, "101.0.0.1", body) + + body, r, err = getHeader("http://127.0.0.1:8177/", map[string]string{ + "X-Forwarded-For": "100.0.0.1, 200.0.0.1, 101.0.0.1, invalid", + }) + + assert.NoError(t, err) + assert.Equal(t, 200, r.StatusCode) + assert.Equal(t, "101.0.0.1", body) } func TestHandler_XForwardedFor_NotTrustedRemoteIp(t *testing.T) { -- cgit v1.2.3