forked from mirror/gin
Adds test for single IP in X-Forwarded-For
This commit is contained in:
parent
967e62337a
commit
80d3cc6b75
|
@ -408,6 +408,8 @@ func TestContextClientIP(t *testing.T) {
|
||||||
assert.Equal(t, c.ClientIP(), "10.10.10.10")
|
assert.Equal(t, c.ClientIP(), "10.10.10.10")
|
||||||
c.Request.Header.Del("X-Real-IP")
|
c.Request.Header.Del("X-Real-IP")
|
||||||
assert.Equal(t, c.ClientIP(), "20.20.20.20")
|
assert.Equal(t, c.ClientIP(), "20.20.20.20")
|
||||||
|
c.Request.Header.Set("X-Forwarded-For", "30.30.30.30")
|
||||||
|
assert.Equal(t, c.ClientIP(), "30.30.30.30")
|
||||||
c.Request.Header.Del("X-Forwarded-For")
|
c.Request.Header.Del("X-Forwarded-For")
|
||||||
assert.Equal(t, c.ClientIP(), "40.40.40.40")
|
assert.Equal(t, c.ClientIP(), "40.40.40.40")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue