use std http method constant instead of raw string

This commit is contained in:
zihengCat 2021-07-08 23:35:09 +08:00
parent c7a28f8532
commit f2896f71d1

2
gin.go
View File

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