1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 09:57:01 +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"
}
}
}

View File

@@ -366,6 +366,10 @@ func logController(logger *golog.Logger, c *ControllerActivator) {
return
}
if c.injector == nil { // when no actual controller methods are registered.
return
}
/*
[DBUG] controller.GreetController
╺ Service → ./service/greet_service.go:16
@@ -381,7 +385,6 @@ func logController(logger *golog.Logger, c *ControllerActivator) {
logger.TimeFormat = ""
printer := logger.Printer
reports := c.injector.Container.Reports
ctrlName := c.RelName()
ctrlScopeType := ""