mirror of
https://github.com/gin-gonic/gin.git
synced 2026-01-11 09:06:56 +08:00
Compare commits
2 Commits
11878ce94a
...
20f8106366
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20f8106366 | ||
|
|
9b8104279b |
@ -1181,7 +1181,11 @@ func TestContextClientIPWithMultipleHeaders(t *testing.T) {
|
||||
|
||||
func TestContextClientIPWithSingleHeader(t *testing.T) {
|
||||
engine := New()
|
||||
engine.SetTrustedProxies([]string{"127.0.0.1"})
|
||||
|
||||
if err := engine.SetTrustedProxies([]string{"127.0.0.1"}); err != nil {
|
||||
t.Fatalf("SetTrustedProxies failed: %v", err)
|
||||
}
|
||||
|
||||
engine.ForwardedByClientIP = true
|
||||
engine.RemoteIPHeaders = []string{"X-Forwarded-For"}
|
||||
|
||||
@ -1195,7 +1199,6 @@ func TestContextClientIPWithSingleHeader(t *testing.T) {
|
||||
c.engine = engine
|
||||
|
||||
clientIP := c.ClientIP()
|
||||
|
||||
// Should return 1.2.3.4
|
||||
expected := "1.2.3.4"
|
||||
if clientIP != expected {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user