mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 21:32:11 +08:00
Merge bb2a73c9004201030a2be6af78319a096b3bb7b8 into 98af44604c755936c31d990f7135b34e1433095f
This commit is contained in:
commit
3bccfbc3dd
5
gin.go
5
gin.go
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user