Browse Source

Added Overwrite method.

multiapp-subsubapp
Benjamin Shelton 3 months ago
parent
commit
fe5bce82cd
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      trie.go

+ 11
- 0
trie.go View File

@ -424,6 +424,17 @@ func (t *proxyTrie) IsRoot() bool {
return t.label == rune(0) && t.prefix == "" && t.handler == nil
}
// Overwrite the handler contained in the specified pattern. If the pattern
// doesn't exist, Overwrite returns false.
func (t *proxyTrie) Overwrite(pattern string, handler http.Handler) bool {
node := t.lookup(pattern)
if node == nil {
return false
}
node.handler = handler
return true
}
// Lookup accepts a single pattern string and traverses the radix trie,
// returning the handler associated with the pattern or nil if the pattern
// cannot be found.


Loading…
Cancel
Save