Skip to content

Commit

Permalink
Merge pull request #100 from karldoenitz/feature-v2.0.0
Browse files Browse the repository at this point in the history
调整枚举函数
  • Loading branch information
karldoenitz authored Oct 14, 2023
2 parents 560be14 + dabd88e commit 1630148
Showing 1 changed file with 35 additions and 16 deletions.
51 changes: 35 additions & 16 deletions TigoWeb/enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,45 @@ package TigoWeb

const Version = "1.6.5"

const (
httpLowerGet = "get"
httpLowerHead = "head"
httpLowerPost = "post"
httpLowerPut = "put"
httpLowerDelete = "delete"
httpLowerConnect = "connect"
httpLowerOptions = "options"
httpLowerTrace = "trace"
httpUpperGet = "GET"
httpUpperHead = "HEAD"
httpUpperPost = "POST"
httpUpperPut = "PUT"
httpUpperDelete = "DELETE"
httpUpperConnect = "CONNECT"
httpUpperOptions = "OPTIONS"
httpUpperTrace = "TRACE"
)

// MethodEnum 根据http请求方式获取对应的函数名
// - httpMethod: http请求方式
func MethodEnum(httpMethod string) string {
var MethodMapping = map[string]string{
"get": "Get",
"head": "Head",
"post": "Post",
"put": "Put",
"delete": "Delete",
"connect": "Connect",
"options": "Options",
"trace": "Trace",
"GET": "Get",
"HEAD": "Head",
"POST": "Post",
"PUT": "Put",
"DELETE": "Delete",
"CONNECT": "Connect",
"OPTIONS": "Options",
"TRACE": "Trace",
httpLowerGet: "Get",
httpLowerHead: "Head",
httpLowerPost: "Post",
httpLowerPut: "Put",
httpLowerDelete: "Delete",
httpLowerConnect: "Connect",
httpLowerOptions: "Options",
httpLowerTrace: "Trace",
httpUpperGet: "Get",
httpUpperHead: "Head",
httpUpperPost: "Post",
httpUpperPut: "Put",
httpUpperDelete: "Delete",
httpUpperConnect: "Connect",
httpUpperOptions: "Options",
httpUpperTrace: "Trace",
}
return MethodMapping[httpMethod]
}

0 comments on commit 1630148

Please sign in to comment.