~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/julienschmidt/httprouter/tree.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
type nodeType uint8
34
34
 
35
35
const (
36
 
        static   nodeType = 0
37
 
        param    nodeType = 1
38
 
        catchAll nodeType = 2
 
36
        static nodeType = iota // default
 
37
        root
 
38
        param
 
39
        catchAll
39
40
)
40
41
 
41
42
type node struct {
187
188
 
188
189
                        } else if i == len(path) { // Make node a (in-path) leaf
189
190
                                if n.handle != nil {
190
 
                                        panic("a handle is already registered for path ''" + fullPath + "'")
 
191
                                        panic("a handle is already registered for path '" + fullPath + "'")
191
192
                                }
192
193
                                n.handle = handle
193
194
                        }
195
196
                }
196
197
        } else { // Empty tree
197
198
                n.insertChild(numParams, path, fullPath, handle)
 
199
                n.nType = root
198
200
        }
199
201
}
200
202
 
411
413
                                return
412
414
                        }
413
415
 
 
416
                        if path == "/" && n.wildChild && n.nType != root {
 
417
                                tsr = true
 
418
                                return
 
419
                        }
 
420
 
414
421
                        // No handle found. Check if a handle for this path + a
415
422
                        // trailing slash exists for trailing slash recommendation
416
423
                        for i := 0; i < len(n.indices); i++ {