TestRouteRedirectFixedPath() — gin Function Reference
Architecture documentation for the TestRouteRedirectFixedPath() function in routes_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 717ab9ca_e067_966b_2380_c5d9364736ad["TestRouteRedirectFixedPath()"] 69c2add5_555a_3d82_a4e7_993886631a2c["PerformRequest()"] 717ab9ca_e067_966b_2380_c5d9364736ad -->|calls| 69c2add5_555a_3d82_a4e7_993886631a2c style 717ab9ca_e067_966b_2380_c5d9364736ad fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
routes_test.go lines 249–274
func TestRouteRedirectFixedPath(t *testing.T) {
router := New()
router.RedirectFixedPath = true
router.RedirectTrailingSlash = false
router.GET("/path", func(c *Context) {})
router.GET("/Path2", func(c *Context) {})
router.POST("/PATH3", func(c *Context) {})
router.POST("/Path4/", func(c *Context) {})
w := PerformRequest(router, http.MethodGet, "/PATH")
assert.Equal(t, "/path", w.Header().Get("Location"))
assert.Equal(t, http.StatusMovedPermanently, w.Code)
w = PerformRequest(router, http.MethodGet, "/path2")
assert.Equal(t, "/Path2", w.Header().Get("Location"))
assert.Equal(t, http.StatusMovedPermanently, w.Code)
w = PerformRequest(router, http.MethodPost, "/path3")
assert.Equal(t, "/PATH3", w.Header().Get("Location"))
assert.Equal(t, http.StatusTemporaryRedirect, w.Code)
w = PerformRequest(router, http.MethodPost, "/path4")
assert.Equal(t, "/Path4/", w.Header().Get("Location"))
assert.Equal(t, http.StatusTemporaryRedirect, w.Code)
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does TestRouteRedirectFixedPath() do?
TestRouteRedirectFixedPath() is a function in the gin codebase.
What does TestRouteRedirectFixedPath() call?
TestRouteRedirectFixedPath() 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