1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-10-31 05:04:05 +02:00
parent b335ab9c78
commit a70ee32ebd
12 changed files with 927 additions and 15 deletions

View File

@@ -47,24 +47,25 @@ func (g GRPC) Apply(c *ControllerActivator) {
return
}
if g.Strict {
ctx.NotFound()
} else {
// Allow common HTTP clients, consumes and produces JSON.
ctx.Next()
}
// If strict was false, allow common HTTP clients, consumes and produces JSON.
ctx.Next()
}
for i := 0; i < c.Type.NumMethod(); i++ {
m := c.Type.Method(i)
path := path.Join(g.ServiceName, m.Name)
if route := c.Handle(http.MethodPost, path, m.Name, pre); route != nil {
bckp := route.Description
route.Description = "gRPC"
if g.Strict {
route.Description += "-only"
if g.Strict {
c.app.Router.HandleMany(http.MethodPost, path, pre)
} else {
if route := c.Handle(http.MethodPost, path, m.Name, pre); route != nil {
bckp := route.Description
route.Description = "gRPC"
if g.Strict {
route.Description += "-only"
}
route.Description += " " + bckp // e.g. "gRPC controller"
}
route.Description += " " + bckp // e.g. "gRPC controller"
}
}
}