Home / Function/ TestConcurrentHandleContext() — gin Function Reference

TestConcurrentHandleContext() — gin Function Reference

Architecture documentation for the TestConcurrentHandleContext() function in gin_integration_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  2bfb6627_95b6_1c18_f198_6ca9dab81379["TestConcurrentHandleContext()"]
  076d326a_acfa_c808_1141_d1324fc6e43a["gin_integration_test.go"]
  2bfb6627_95b6_1c18_f198_6ca9dab81379 -->|defined in| 076d326a_acfa_c808_1141_d1324fc6e43a
  style 2bfb6627_95b6_1c18_f198_6ca9dab81379 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

gin_integration_test.go lines 392–417

func TestConcurrentHandleContext(t *testing.T) {
	router := New()
	router.GET("/", func(c *Context) {
		c.Request.URL.Path = "/example"
		router.HandleContext(c)
	})
	router.GET("/example", func(c *Context) { c.String(http.StatusOK, "it worked") })

	var wg sync.WaitGroup
	iterations := 200
	wg.Add(iterations)
	for range iterations {
		go func() {
			req, err := http.NewRequest(http.MethodGet, "/", nil)
			assert.NoError(t, err)

			w := httptest.NewRecorder()
			router.ServeHTTP(w, req)

			assert.Equal(t, "it worked", w.Body.String(), "resp body should match")
			assert.Equal(t, 200, w.Code, "should get a 200")
			wg.Done()
		}()
	}
	wg.Wait()
}

Domain

Subdomains

Frequently Asked Questions

What does TestConcurrentHandleContext() do?
TestConcurrentHandleContext() is a function in the gin codebase, defined in gin_integration_test.go.
Where is TestConcurrentHandleContext() defined?
TestConcurrentHandleContext() is defined in gin_integration_test.go at line 392.

Analyze Your Own Codebase

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

Try Supermodel Free