mirror of
https://github.com/gin-gonic/gin.git
synced 2026-07-15 15:51:17 +08:00
lint error fixed
This commit is contained in:
parent
8b2b6f8ee0
commit
9b8104279b
@ -1181,7 +1181,11 @@ func TestContextClientIPWithMultipleHeaders(t *testing.T) {
|
|||||||
|
|
||||||
func TestContextClientIPWithSingleHeader(t *testing.T) {
|
func TestContextClientIPWithSingleHeader(t *testing.T) {
|
||||||
engine := New()
|
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.ForwardedByClientIP = true
|
||||||
engine.RemoteIPHeaders = []string{"X-Forwarded-For"}
|
engine.RemoteIPHeaders = []string{"X-Forwarded-For"}
|
||||||
|
|
||||||
@ -1195,7 +1199,6 @@ func TestContextClientIPWithSingleHeader(t *testing.T) {
|
|||||||
c.engine = engine
|
c.engine = engine
|
||||||
|
|
||||||
clientIP := c.ClientIP()
|
clientIP := c.ClientIP()
|
||||||
|
|
||||||
// Should return 1.2.3.4
|
// Should return 1.2.3.4
|
||||||
expected := "1.2.3.4"
|
expected := "1.2.3.4"
|
||||||
if clientIP != expected {
|
if clientIP != expected {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user