mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-17 05:42:09 +08:00
add unit test
This commit is contained in:
parent
feaee20a81
commit
2d7fc06969
@ -2027,3 +2027,12 @@ func TestContextWithKeysMutex(t *testing.T) {
|
||||
assert.Nil(t, value)
|
||||
assert.False(t, err)
|
||||
}
|
||||
|
||||
func TestRemoteIPFail(t *testing.T) {
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
c.Request, _ = http.NewRequest("POST", "/", nil)
|
||||
c.Request.RemoteAddr = "[:::]:80"
|
||||
ip, trust := c.RemoteIP()
|
||||
assert.Nil(t, ip)
|
||||
assert.False(t, trust)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user