httptreemux icon indicating copy to clipboard operation
httptreemux copied to clipboard

Remove routes

Open kabukky opened this issue 7 years ago • 5 comments

Since we can now add routes at runtime (using the mutex), I think it would be appropriate to provide a function to remove routes as well.

Please excuse me if there is such a function already. I couldn't find anything.

kabukky avatar Mar 21 '17 10:03 kabukky

Yeah, this should be pretty easy to do. I can add it some time this month.

dimfeld avatar Mar 21 '17 17:03 dimfeld

Great :) A function to remove all routes would be good as well.

kabukky avatar Mar 22 '17 10:03 kabukky

Sorry, I see this issue, but I still don't see the solution. Is it possible to add this feature?

yifanes avatar Jan 03 '20 07:01 yifanes

It turned out to be a bit tricky, and nobody seemed to care that much so I never implemented it. If someone wants to submit a PR I'm glad to look it over. The tricky part is that adding a route can sometimes add a few different entires into the tree, such as implicit HEAD handlers for a GET operation, so the remove operation needs to get rid of them all.

dimfeld avatar Jan 03 '20 20:01 dimfeld

I just remembered there's a branch where I started some of this work: https://github.com/dimfeld/httptreemux/tree/delete_routes

The commit says "mostly complete" and it's been so long that I can't remember what, if anything, is missing from it. It's definitely missing tests.

dimfeld avatar Jan 04 '20 00:01 dimfeld