Adds test for single IP in X-Forwarded-For

This commit is contained in:
Manu Mtz-Almeida 2015-05-24 15:28:58 +02:00
parent 967e62337a
commit 80d3cc6b75

View File

@ -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")
} }