HandleMany works like `Handle` but can receive more than one paths separated by spaces and returns always a slice of *Route instead of a single instance of Route. It's useful only if the same handler can handle more than one request paths, otherwise use `Party` which can handle many paths with diff
(methodOrMulti string, relativePathorMulti string, handlers ...context.Handler)
| 587 | // |
| 588 | // app.HandleMany("GET POST", "/path", handler) |
| 589 | func (api *APIBuilder) HandleMany(methodOrMulti string, relativePathorMulti string, handlers ...context.Handler) (routes []*Route) { |
| 590 | // at least slash |
| 591 | // a space |
| 592 | // at least one other slash for the next path |
| 593 | paths := splitPath(relativePathorMulti) |
| 594 | methods := splitMethod(methodOrMulti) |
| 595 | for _, p := range paths { |
| 596 | if p != "" { |
| 597 | for _, method := range methods { |
| 598 | if method == "" { |
| 599 | method = "ANY" |
| 600 | } |
| 601 | if method == "ANY" || method == "ALL" { |
| 602 | routes = append(routes, api.Any(p, handlers...)...) |
| 603 | continue |
| 604 | } |
| 605 | routes = append(routes, api.Handle(method, p, handlers...)) |
| 606 | } |
| 607 | } |
| 608 | } |
| 609 | return |
| 610 | } |
| 611 | |
| 612 | // HandleDir registers a handler that serves HTTP requests |
| 613 | // with the contents of a file system (physical or embedded). |
no test coverage detected