Home / Function/ TestUnescapeParameters() — gin Function Reference

TestUnescapeParameters() — gin Function Reference

Architecture documentation for the TestUnescapeParameters() function in tree_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  6b776026_b26e_f65d_cb34_4edff32040fc["TestUnescapeParameters()"]
  95642d64_cc2a_14f0_a93c_52464b2a60b9["tree_test.go"]
  6b776026_b26e_f65d_cb34_4edff32040fc -->|defined in| 95642d64_cc2a_14f0_a93c_52464b2a60b9
  93c1c821_291f_3e71_2ae0_563c40ff3ee5["fakeHandler()"]
  6b776026_b26e_f65d_cb34_4edff32040fc -->|calls| 93c1c821_291f_3e71_2ae0_563c40ff3ee5
  8d0f5c35_d7ba_9350_dd86_97ac6e33ccfa["checkRequests()"]
  6b776026_b26e_f65d_cb34_4edff32040fc -->|calls| 8d0f5c35_d7ba_9350_dd86_97ac6e33ccfa
  d156c0cc_ed4f_7800_da03_d68e73428a71["checkPriorities()"]
  6b776026_b26e_f65d_cb34_4edff32040fc -->|calls| d156c0cc_ed4f_7800_da03_d68e73428a71
  style 6b776026_b26e_f65d_cb34_4edff32040fc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tree_test.go lines 325–360

func TestUnescapeParameters(t *testing.T) {
	tree := &node{}

	routes := [...]string{
		"/",
		"/cmd/:tool/:sub",
		"/cmd/:tool/",
		"/src/*filepath",
		"/search/:query",
		"/files/:dir/*filepath",
		"/info/:user/project/:project",
		"/info/:user",
	}
	for _, route := range routes {
		tree.addRoute(route, fakeHandler(route))
	}

	unescape := true
	checkRequests(t, tree, testRequests{
		{"/", false, "/", nil},
		{"/cmd/test/", false, "/cmd/:tool/", Params{Param{Key: "tool", Value: "test"}}},
		{"/cmd/test", true, "", Params{Param{Key: "tool", Value: "test"}}},
		{"/src/some/file.png", false, "/src/*filepath", Params{Param{Key: "filepath", Value: "/some/file.png"}}},
		{"/src/some/file+test.png", false, "/src/*filepath", Params{Param{Key: "filepath", Value: "/some/file test.png"}}},
		{"/src/some/file++++%%%%test.png", false, "/src/*filepath", Params{Param{Key: "filepath", Value: "/some/file++++%%%%test.png"}}},
		{"/src/some/file%2Ftest.png", false, "/src/*filepath", Params{Param{Key: "filepath", Value: "/some/file/test.png"}}},
		{"/search/someth!ng+in+ünìcodé", false, "/search/:query", Params{Param{Key: "query", Value: "someth!ng in ünìcodé"}}},
		{"/info/gordon/project/go", false, "/info/:user/project/:project", Params{Param{Key: "user", Value: "gordon"}, Param{Key: "project", Value: "go"}}},
		{"/info/slash%2Fgordon", false, "/info/:user", Params{Param{Key: "user", Value: "slash/gordon"}}},
		{"/info/slash%2Fgordon/project/Project%20%231", false, "/info/:user/project/:project", Params{Param{Key: "user", Value: "slash/gordon"}, Param{Key: "project", Value: "Project #1"}}},
		{"/info/slash%%%%", false, "/info/:user", Params{Param{Key: "user", Value: "slash%%%%"}}},
		{"/info/slash%%%%2Fgordon/project/Project%%%%20%231", false, "/info/:user/project/:project", Params{Param{Key: "user", Value: "slash%%%%2Fgordon"}, Param{Key: "project", Value: "Project%%%%20%231"}}},
	}, unescape)

	checkPriorities(t, tree)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestUnescapeParameters() do?
TestUnescapeParameters() is a function in the gin codebase, defined in tree_test.go.
Where is TestUnescapeParameters() defined?
TestUnescapeParameters() is defined in tree_test.go at line 325.
What does TestUnescapeParameters() call?
TestUnescapeParameters() calls 3 function(s): checkPriorities, checkRequests, fakeHandler.

Analyze Your Own Codebase

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

Try Supermodel Free