use std http method constant instead of raw string (#2782)

This commit is contained in:
ziheng 2021-07-09 10:30:44 +08:00 committed by GitHub
parent c7a28f8532
commit 3116a2d7a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
gin.go
View File

@ -539,7 +539,7 @@ func (engine *Engine) handleHTTPRequest(c *Context) {
c.writermem.WriteHeaderNow() c.writermem.WriteHeaderNow()
return return
} }
if httpMethod != "CONNECT" && rPath != "/" { if httpMethod != http.MethodConnect && rPath != "/" {
if value.tsr && engine.RedirectTrailingSlash { if value.tsr && engine.RedirectTrailingSlash {
redirectTrailingSlash(c) redirectTrailingSlash(c)
return return