mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-18 23:12:17 +08:00
chore(engine): remove unused lookupHost
This commit is contained in:
parent
c9ea8ece4a
commit
39b372f163
@ -1392,19 +1392,6 @@ func TestContextClientIP(t *testing.T) {
|
|||||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||||
c.Request, _ = http.NewRequest("POST", "/", nil)
|
c.Request, _ = http.NewRequest("POST", "/", nil)
|
||||||
|
|
||||||
c.engine.lookupHost = func(host string) ([]string, error) {
|
|
||||||
if host == "foo" {
|
|
||||||
return []string{"40.40.40.40", "30.30.30.30"}, nil
|
|
||||||
}
|
|
||||||
if host == "bar" {
|
|
||||||
return nil, errors.New("hostname lookup failed")
|
|
||||||
}
|
|
||||||
if host == "baz" {
|
|
||||||
return []string{"thisshouldneverhappen"}, nil
|
|
||||||
}
|
|
||||||
return []string{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
resetContextForClientIPTests(c)
|
resetContextForClientIPTests(c)
|
||||||
|
|
||||||
// Legacy tests (validating that the defaults don't break the
|
// Legacy tests (validating that the defaults don't break the
|
||||||
|
3
gin.go
3
gin.go
@ -106,8 +106,6 @@ type Engine struct {
|
|||||||
// See the PR #1817 and issue #1644
|
// See the PR #1817 and issue #1644
|
||||||
RemoveExtraSlash bool
|
RemoveExtraSlash bool
|
||||||
|
|
||||||
lookupHost func(string) ([]string, error)
|
|
||||||
|
|
||||||
delims render.Delims
|
delims render.Delims
|
||||||
secureJSONPrefix string
|
secureJSONPrefix string
|
||||||
HTMLRender render.HTMLRender
|
HTMLRender render.HTMLRender
|
||||||
@ -152,7 +150,6 @@ func New() *Engine {
|
|||||||
RemoveExtraSlash: false,
|
RemoveExtraSlash: false,
|
||||||
UnescapePathValues: true,
|
UnescapePathValues: true,
|
||||||
MaxMultipartMemory: defaultMultipartMemory,
|
MaxMultipartMemory: defaultMultipartMemory,
|
||||||
lookupHost: net.LookupHost,
|
|
||||||
trees: make(methodTrees, 0, 9),
|
trees: make(methodTrees, 0, 9),
|
||||||
delims: render.Delims{Left: "{{", Right: "}}"},
|
delims: render.Delims{Left: "{{", Right: "}}"},
|
||||||
secureJSONPrefix: "while(1);",
|
secureJSONPrefix: "while(1);",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user