summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorSmolyakov <[email protected]>2019-09-01 16:54:22 +0300
committerSmolyakov <[email protected]>2019-09-01 16:54:22 +0300
commitdef26e1c757815bee024c1181ea1bb66c399156b (patch)
treeae74ef0e705dd9ced2a24c9538ed0e69461b683a /service
parentdc538ff3a2d58ef8472072f75039f49cd16a230d (diff)
Add case in test
Diffstat (limited to 'service')
-rw-r--r--service/http/handler_test.go8
1 files changed, 8 insertions, 0 deletions
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) {