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
  91666376_8358_aa4b_d0cb_bcada4198cd7["TestUnescapeParameters()"]
  6dab8d3e_0986_1500_b06f_6323ea7ce91a["fakeHandler()"]
  91666376_8358_aa4b_d0cb_bcada4198cd7 -->|calls| 6dab8d3e_0986_1500_b06f_6323ea7ce91a
  4c07e1ac_0102_9e6b_694c_072ecd891dad["checkRequests()"]
  91666376_8358_aa4b_d0cb_bcada4198cd7 -->|calls| 4c07e1ac_0102_9e6b_694c_072ecd891dad
  f6753205_2ff0_1d6d_ec58_954c26acae9b["checkPriorities()"]
  91666376_8358_aa4b_d0cb_bcada4198cd7 -->|calls| f6753205_2ff0_1d6d_ec58_954c26acae9b
  style 91666376_8358_aa4b_d0cb_bcada4198cd7 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

Frequently Asked Questions

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