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

Function TestTreeRootTrailingSlashRedirect

tree_test.go:676–692  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

674}
675
676func TestTreeRootTrailingSlashRedirect(t *testing.T) {
677 tree := &node{}
678
679 recv := catchPanic(func() {
680 tree.addRoute("/:test", fakeHandler("/:test"))
681 })
682 if recv != nil {
683 t.Fatalf("panic inserting test route: %v", recv)
684 }
685
686 value := tree.getValue("/", nil, getSkippedNodes(), false)
687 if value.handlers != nil {
688 t.Fatalf("non-nil handler")
689 } else if value.tsr {
690 t.Errorf("expected no TSR recommendation")
691 }
692}
693
694func TestRedirectTrailingSlash(t *testing.T) {
695 data := []struct {

Callers

nothing calls this directly

Calls 5

addRouteMethod · 0.95
getValueMethod · 0.95
catchPanicFunction · 0.85
fakeHandlerFunction · 0.85
getSkippedNodesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…