RemoveRoute is used to remove a route from the stack by path. If no methods are specified, it will remove the route for all methods defined in the app. You should call RebuildTree after using this to ensure consistency of the tree.
(path string, methods ...string)
| 539 | // If no methods are specified, it will remove the route for all methods defined in the app. |
| 540 | // You should call RebuildTree after using this to ensure consistency of the tree. |
| 541 | func (app *App) RemoveRoute(path string, methods ...string) { |
| 542 | // Normalize same as register uses |
| 543 | norm := app.normalizePath(path) |
| 544 | |
| 545 | pathMatchFunc := func(r *Route) bool { |
| 546 | return r.path == norm // compare private normalized path |
| 547 | } |
| 548 | app.deleteRoute(methods, pathMatchFunc) |
| 549 | } |
| 550 | |
| 551 | // RemoveRouteByName is used to remove a route from the stack by name. |
| 552 | // If no methods are specified, it will remove the route for all methods defined in the app. |