Merge bb2a73c9004201030a2be6af78319a096b3bb7b8 into 98af44604c755936c31d990f7135b34e1433095f

This commit is contained in:
Jace Shim 2016-12-06 13:45:37 +00:00 committed by GitHub
commit 3bccfbc3dd

5
gin.go
View File

@ -78,6 +78,7 @@ type (
// handler.
HandleMethodNotAllowed bool
ForwardedByClientIP bool
UseRawPath bool
}
)
@ -102,6 +103,7 @@ func New() *Engine {
HandleMethodNotAllowed: false,
ForwardedByClientIP: true,
trees: make(methodTrees, 0, 9),
UseRawPath: false,
}
engine.RouterGroup.engine = engine
engine.pool.New = func() interface{} {
@ -270,6 +272,9 @@ func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) {
func (engine *Engine) handleHTTPRequest(context *Context) {
httpMethod := context.Request.Method
path := context.Request.URL.Path
if (engine.UseRawPath && len(context.Request.URL.RawPath) > 0 ) {
path = context.Request.URL.RawPath
}
// Find root of the tree for the given HTTP method
t := engine.trees