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

Function TestTreeRootTrailingSlashRedirect

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

Source from the content-addressed store, hash-verified

469}
470
471func TestTreeRootTrailingSlashRedirect(t *testing.T) {
472 tree := &node{}
473
474 recv := catchPanic(func() {
475 tree.addRoute("/:test", fakeHandler("/:test"))
476 })
477 if recv != nil {
478 t.Fatalf("panic inserting test route: %v", recv)
479 }
480
481 handler, _, tsr := tree.getValue("/")
482 if handler != nil {
483 t.Fatalf("non-nil handler")
484 } else if tsr {
485 t.Errorf("expected no TSR recommendation")
486 }
487}
488
489func TestTreeFindCaseInsensitivePath(t *testing.T) {
490 tree := &node{}

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected