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)
| 590 | // It returns the case-corrected path and a bool indicating whether the lookup |
| 591 | // was successful. |
| 592 | func (n *Node) findCaseInsensitivePath(path string, fixTrailingSlash bool) (ciPath []byte, found bool) { |
| 593 | return n.findCaseInsensitivePathRec( |
| 594 | path, |
| 595 | strings.ToLower(path), |
| 596 | make([]byte, 0, len(path)+1), // preallocate enough memory for new path |
| 597 | [4]byte{}, // empty rune buffer |
| 598 | fixTrailingSlash, |
| 599 | ) |
| 600 | } |
| 601 | |
| 602 | // shift bytes in array by n bytes left |
| 603 | func shiftNRuneBytes(rb [4]byte, n int) [4]byte { |
no test coverage detected