Home / Function/ TestLiteralColonWithHTTPServer() — gin Function Reference

TestLiteralColonWithHTTPServer() — gin Function Reference

Architecture documentation for the TestLiteralColonWithHTTPServer() function in gin_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  68f032dd_26d5_874b_d363_09834c3f78f3["TestLiteralColonWithHTTPServer()"]
  5d6e7276_feeb_b8e2_30e8_0ae0827740a5["gin_test.go"]
  68f032dd_26d5_874b_d363_09834c3f78f3 -->|defined in| 5d6e7276_feeb_b8e2_30e8_0ae0827740a5
  style 68f032dd_26d5_874b_d363_09834c3f78f3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

gin_test.go lines 1043–1068

func TestLiteralColonWithHTTPServer(t *testing.T) {
	SetMode(TestMode)
	router := New()

	router.GET(`/test\:action`, func(c *Context) {
		c.JSON(http.StatusOK, H{"path": "literal_colon"})
	})

	router.GET("/test/:param", func(c *Context) {
		c.JSON(http.StatusOK, H{"param": c.Param("param")})
	})

	w := httptest.NewRecorder()
	req, _ := http.NewRequest(http.MethodGet, "/test:action", nil)
	router.ServeHTTP(w, req)

	assert.Equal(t, http.StatusOK, w.Code)
	assert.Contains(t, w.Body.String(), "literal_colon")

	w2 := httptest.NewRecorder()
	req2, _ := http.NewRequest(http.MethodGet, "/test/foo", nil)
	router.ServeHTTP(w2, req2)

	assert.Equal(t, http.StatusOK, w2.Code)
	assert.Contains(t, w2.Body.String(), "foo")
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestLiteralColonWithHTTPServer() do?
TestLiteralColonWithHTTPServer() is a function in the gin codebase, defined in gin_test.go.
Where is TestLiteralColonWithHTTPServer() defined?
TestLiteralColonWithHTTPServer() is defined in gin_test.go at line 1043.

Analyze Your Own Codebase

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

Try Supermodel Free