Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no way to remove the route? #1124

Closed
monikaYZ opened this issue Oct 8, 2017 · 5 comments
Closed

There is no way to remove the route? #1124

monikaYZ opened this issue Oct 8, 2017 · 5 comments

Comments

@monikaYZ
Copy link

monikaYZ commented Oct 8, 2017

There is no way to remove the route?

@monikaYZ
Copy link
Author

monikaYZ commented Oct 8, 2017

func (engine *Engine) RemoveRoute(path string) bool {
for _, tree := range engine.trees {
find("", path, tree.root, tree.root)
}
return true
}

func find(path, targetRoute string, root *node, org *node) {
path += root.path
if len(root.handlers) > 0 && strings.EqualFold(path, targetRoute) {
//清理 handlers chain
var hd HandlersChain
root.handlers = hd
return
}
for _, child := range root.children {
find(path, targetRoute, child, root)
}
}

@rfyiamcool
Copy link

@monikaYZ I thank U delete uro route in net.http.Server handler struct.

@tsirolnik
Copy link
Contributor

We can't understand your problem this way

  • Format your code with the Go code tag
  • Present the issue in a better way
  • Use English comments

@thinkerou
Copy link
Member

thinkerou commented Aug 31, 2018

please post more details and closing, if you still problem please reopen and discuss. thanks! duplicated #776

@pi314pi
Copy link

pi314pi commented Apr 26, 2020

I also need a dynamic route. Please support deleting or canceling routing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants