Home / Function/ TestRouteParamsByNameWithExtraSlash() — gin Function Reference

TestRouteParamsByNameWithExtraSlash() — gin Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

routes_test.go lines 309–339

func TestRouteParamsByNameWithExtraSlash(t *testing.T) {
	name := ""
	lastName := ""
	wild := ""
	router := New()
	router.RemoveExtraSlash = true
	router.GET("/test/:name/:last_name/*wild", func(c *Context) {
		name = c.Params.ByName("name")
		lastName = c.Params.ByName("last_name")
		var ok bool
		wild, ok = c.Params.Get("wild")

		assert.True(t, ok)
		assert.Equal(t, name, c.Param("name"))
		assert.Equal(t, lastName, c.Param("last_name"))

		assert.Empty(t, c.Param("wtf"))
		assert.Empty(t, c.Params.ByName("wtf"))

		wtf, ok := c.Params.Get("wtf")
		assert.Empty(t, wtf)
		assert.False(t, ok)
	})

	w := PerformRequest(router, http.MethodGet, "//test//john//smith//is//super//great")

	assert.Equal(t, http.StatusOK, w.Code)
	assert.Equal(t, "john", name)
	assert.Equal(t, "smith", lastName)
	assert.Equal(t, "/is/super/great", wild)
}

Domain

Subdomains

Frequently Asked Questions

What does TestRouteParamsByNameWithExtraSlash() do?
TestRouteParamsByNameWithExtraSlash() is a function in the gin codebase.
What does TestRouteParamsByNameWithExtraSlash() call?
TestRouteParamsByNameWithExtraSlash() 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