MCPcopy
hub / github.com/julienschmidt/httprouter / findCaseInsensitivePath

Method findCaseInsensitivePath

tree.go:466–473  ·  view source on GitHub ↗

Makes a case-insensitive lookup of the given path and tries to find a handler. It can optionally also fix trailing slashes. It returns the case-corrected path and a bool indicating whether the lookup was successful.

(path string, fixTrailingSlash bool)

Source from the content-addressed store, hash-verified

464// It returns the case-corrected path and a bool indicating whether the lookup
465// was successful.
466func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) (ciPath []byte, found bool) {
467 return n.findCaseInsensitivePathRec(
468 path,
469 make([]byte, 0, len(path)+1), // preallocate enough memory for new path
470 [4]byte{}, // empty rune buffer
471 fixTrailingSlash,
472 )
473}
474
475// shift bytes in array by n bytes left
476func shiftNRuneBytes(rb [4]byte, n int) [4]byte {

Callers 3

TestTreeInvalidNodeTypeFunction · 0.95
ServeHTTPMethod · 0.80

Calls 1

Tested by 2

TestTreeInvalidNodeTypeFunction · 0.76