1
0
mirror of https://github.com/beego/bee.git synced 2024-11-21 23:50:54 +00:00

Merge pull request #445 from eyalpost/develop

support multiple http methods
This commit is contained in:
astaxie 2017-06-06 09:54:46 +08:00 committed by GitHub
commit 34faa8fca6

View File

@ -707,7 +707,8 @@ func parserComments(f *ast.FuncDecl, controllerName, pkgpath string) error {
controllerList[pkgpath+controllerName] = make(map[string]*swagger.Item)
item = &swagger.Item{}
}
switch HTTPMethod {
for _, hm := range strings.Split(HTTPMethod, ",") {
switch hm {
case "GET":
item.Get = &opts
case "POST":
@ -723,6 +724,7 @@ func parserComments(f *ast.FuncDecl, controllerName, pkgpath string) error {
case "OPTIONS":
item.Options = &opts
}
}
controllerList[pkgpath+controllerName][routerPath] = item
}
return nil