Home / Function/ TestRouterNotFoundWithRemoveExtraSlash() — gin Function Reference

TestRouterNotFoundWithRemoveExtraSlash() — gin Function Reference

Architecture documentation for the TestRouterNotFoundWithRemoveExtraSlash() function in routes_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  6a42beab_cc1b_2975_7446_f1bd13688e09["TestRouterNotFoundWithRemoveExtraSlash()"]
  69c2add5_555a_3d82_a4e7_993886631a2c["PerformRequest()"]
  6a42beab_cc1b_2975_7446_f1bd13688e09 -->|calls| 69c2add5_555a_3d82_a4e7_993886631a2c
  style 6a42beab_cc1b_2975_7446_f1bd13688e09 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

routes_test.go lines 545–566

func TestRouterNotFoundWithRemoveExtraSlash(t *testing.T) {
	router := New()
	router.RemoveExtraSlash = true
	router.GET("/path", func(c *Context) {})
	router.GET("/", func(c *Context) {})

	testRoutes := []struct {
		route    string
		code     int
		location string
	}{
		{"/../path", http.StatusOK, ""},    // CleanPath
		{"/nope", http.StatusNotFound, ""}, // NotFound
	}
	for _, tr := range testRoutes {
		w := PerformRequest(router, http.MethodGet, tr.route)
		assert.Equal(t, tr.code, w.Code)
		if w.Code != http.StatusNotFound {
			assert.Equal(t, tr.location, w.Header().Get("Location"))
		}
	}
}

Domain

Subdomains

Frequently Asked Questions

What does TestRouterNotFoundWithRemoveExtraSlash() do?
TestRouterNotFoundWithRemoveExtraSlash() is a function in the gin codebase.
What does TestRouterNotFoundWithRemoveExtraSlash() call?
TestRouterNotFoundWithRemoveExtraSlash() calls 1 function(s): PerformRequest.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free