Home / Function/ TestPusher() — gin Function Reference

TestPusher() — gin Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f6f25133_b3f7_2be2_bf77_5fdeeb0e955a["TestPusher()"]
  076d326a_acfa_c808_1141_d1324fc6e43a["gin_integration_test.go"]
  f6f25133_b3f7_2be2_bf77_5fdeeb0e955a -->|defined in| 076d326a_acfa_c808_1141_d1324fc6e43a
  28a99f08_7707_75d8_4467_709023cd3fc2["testRequest()"]
  f6f25133_b3f7_2be2_bf77_5fdeeb0e955a -->|calls| 28a99f08_7707_75d8_4467_709023cd3fc2
  style f6f25133_b3f7_2be2_bf77_5fdeeb0e955a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

gin_integration_test.go lines 173–208

func TestPusher(t *testing.T) {
	html := template.Must(template.New("https").Parse(`
<html>
<head>
  <title>Https Test</title>
  <script src="/assets/app.js"></script>
</head>
<body>
  <h1 style="color:red;">Welcome, Ginner!</h1>
</body>
</html>
`))

	router := New()
	router.Static("./assets", "./assets")
	router.SetHTMLTemplate(html)

	go func() {
		router.GET("/pusher", func(c *Context) {
			if pusher := c.Writer.Pusher(); pusher != nil {
				err := pusher.Push("/assets/app.js", nil)
				assert.NoError(t, err)
			}
			c.String(http.StatusOK, "it worked")
		})

		assert.NoError(t, router.RunTLS(":8449", "./testdata/certificate/cert.pem", "./testdata/certificate/key.pem"))
	}()

	// have to wait for the goroutine to start and run the server
	// otherwise the main thread will complete
	time.Sleep(5 * time.Millisecond)

	require.Error(t, router.RunTLS(":8449", "./testdata/certificate/cert.pem", "./testdata/certificate/key.pem"))
	testRequest(t, "https://localhost:8449/pusher")
}

Domain

Subdomains

Frequently Asked Questions

What does TestPusher() do?
TestPusher() is a function in the gin codebase, defined in gin_integration_test.go.
Where is TestPusher() defined?
TestPusher() is defined in gin_integration_test.go at line 173.
What does TestPusher() call?
TestPusher() calls 1 function(s): testRequest.

Analyze Your Own Codebase

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

Try Supermodel Free