mirror of
https://github.com/beego/bee.git
synced 2024-11-22 05:00:54 +00:00
support multiple http methods
This commit is contained in:
parent
46fc9d75ae
commit
0099ef2f92
@ -707,21 +707,23 @@ func parserComments(f *ast.FuncDecl, controllerName, pkgpath string) error {
|
|||||||
controllerList[pkgpath+controllerName] = make(map[string]*swagger.Item)
|
controllerList[pkgpath+controllerName] = make(map[string]*swagger.Item)
|
||||||
item = &swagger.Item{}
|
item = &swagger.Item{}
|
||||||
}
|
}
|
||||||
switch HTTPMethod {
|
for _, hm := range strings.Split(HTTPMethod, ",") {
|
||||||
case "GET":
|
switch hm {
|
||||||
item.Get = &opts
|
case "GET":
|
||||||
case "POST":
|
item.Get = &opts
|
||||||
item.Post = &opts
|
case "POST":
|
||||||
case "PUT":
|
item.Post = &opts
|
||||||
item.Put = &opts
|
case "PUT":
|
||||||
case "PATCH":
|
item.Put = &opts
|
||||||
item.Patch = &opts
|
case "PATCH":
|
||||||
case "DELETE":
|
item.Patch = &opts
|
||||||
item.Delete = &opts
|
case "DELETE":
|
||||||
case "HEAD":
|
item.Delete = &opts
|
||||||
item.Head = &opts
|
case "HEAD":
|
||||||
case "OPTIONS":
|
item.Head = &opts
|
||||||
item.Options = &opts
|
case "OPTIONS":
|
||||||
|
item.Options = &opts
|
||||||
|
}
|
||||||
}
|
}
|
||||||
controllerList[pkgpath+controllerName][routerPath] = item
|
controllerList[pkgpath+controllerName][routerPath] = item
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user