MCPcopy
hub / github.com/gin-gonic/gin / findCaseInsensitivePath

Method findCaseInsensitivePath

tree.go:671–684  ·  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

669// It returns the case-corrected path and a bool indicating whether the lookup
670// was successful.
671func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) ([]byte, bool) {
672 const stackBufSize = 128
673
674 buf := make([]byte, 0, max(stackBufSize, len(path)+1))
675
676 ciPath := n.findCaseInsensitivePathRec(
677 path,
678 buf, // Preallocate enough memory for new path
679 [4]byte{}, // Empty rune buffer
680 fixTrailingSlash,
681 )
682
683 return ciPath, ciPath != nil
684}
685
686// Shift bytes in array by n bytes left
687func shiftNRuneBytes(rb [4]byte, n int) [4]byte {

Calls 1