mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 21:32:11 +08:00
refactor for unit tests
This commit is contained in:
parent
cab1bb9a40
commit
e540fcfeb6
@ -12,6 +12,7 @@ import (
|
||||
"html/template"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
@ -2051,7 +2052,8 @@ func TestRemoteIPFail(t *testing.T) {
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
c.Request, _ = http.NewRequest("POST", "/", nil)
|
||||
c.Request.RemoteAddr = "[:::]:80"
|
||||
ip, trust := c.RemoteIP()
|
||||
ip := net.ParseIP(c.RemoteIP())
|
||||
trust := c.engine.isTrustedProxy(ip)
|
||||
assert.Nil(t, ip)
|
||||
assert.False(t, trust)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user