Home / Function/ testRequest() — gin Function Reference

testRequest() — gin Function Reference

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

Function go GinCore Context called by 9

Entity Profile

Dependency Diagram

graph TD
  28a99f08_7707_75d8_4467_709023cd3fc2["testRequest()"]
  076d326a_acfa_c808_1141_d1324fc6e43a["gin_integration_test.go"]
  28a99f08_7707_75d8_4467_709023cd3fc2 -->|defined in| 076d326a_acfa_c808_1141_d1324fc6e43a
  93fdc635_ccbd_b3c4_4a73_d7795ba6aa0e["TestRunEmpty()"]
  93fdc635_ccbd_b3c4_4a73_d7795ba6aa0e -->|calls| 28a99f08_7707_75d8_4467_709023cd3fc2
  dd95aa0d_21ac_d61f_9f2d_a5788aca0ae0["TestRunTLS()"]
  dd95aa0d_21ac_d61f_9f2d_a5788aca0ae0 -->|calls| 28a99f08_7707_75d8_4467_709023cd3fc2
  f6f25133_b3f7_2be2_bf77_5fdeeb0e955a["TestPusher()"]
  f6f25133_b3f7_2be2_bf77_5fdeeb0e955a -->|calls| 28a99f08_7707_75d8_4467_709023cd3fc2
  a28e1f41_229d_460c_77a6_a7779508c411["TestRunEmptyWithEnv()"]
  a28e1f41_229d_460c_77a6_a7779508c411 -->|calls| 28a99f08_7707_75d8_4467_709023cd3fc2
  b2f919b7_4695_45c9_f5d7_6cebee8d4fe5["TestRunWithPort()"]
  b2f919b7_4695_45c9_f5d7_6cebee8d4fe5 -->|calls| 28a99f08_7707_75d8_4467_709023cd3fc2
  237c9f2d_aa0d_3604_f059_75b6bc589eed["TestRunQUIC()"]
  237c9f2d_aa0d_3604_f059_75b6bc589eed -->|calls| 28a99f08_7707_75d8_4467_709023cd3fc2
  7c90cfb9_4313_b353_f509_03aaf65b5a58["TestWithHttptestWithAutoSelectedPort()"]
  7c90cfb9_4313_b353_f509_03aaf65b5a58 -->|calls| 28a99f08_7707_75d8_4467_709023cd3fc2
  689f4823_da86_776c_b41c_3e7c3992b2dd["TestTreeRunDynamicRouting()"]
  689f4823_da86_776c_b41c_3e7c3992b2dd -->|calls| 28a99f08_7707_75d8_4467_709023cd3fc2
  7267e09f_e1ec_2d89_0393_cd8ac5103ed3["TestEscapedColon()"]
  7267e09f_e1ec_2d89_0393_cd8ac5103ed3 -->|calls| 28a99f08_7707_75d8_4467_709023cd3fc2
  style 28a99f08_7707_75d8_4467_709023cd3fc2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

gin_integration_test.go lines 31–64

func testRequest(t *testing.T, params ...string) {
	if len(params) == 0 {
		t.Fatal("url cannot be empty")
	}

	tr := &http.Transport{
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: true,
		},
	}
	client := &http.Client{Transport: tr}

	resp, err := client.Get(params[0])
	require.NoError(t, err)
	defer resp.Body.Close()

	body, ioerr := io.ReadAll(resp.Body)
	require.NoError(t, ioerr)

	responseStatus := "200 OK"
	if len(params) > 1 && params[1] != "" {
		responseStatus = params[1]
	}

	responseBody := "it worked"
	if len(params) > 2 && params[2] != "" {
		responseBody = params[2]
	}

	assert.Equal(t, responseStatus, resp.Status, "should get a "+responseStatus)
	if responseStatus == "200 OK" {
		assert.Equal(t, responseBody, string(body), "resp body should match")
	}
}

Domain

Subdomains

Frequently Asked Questions

What does testRequest() do?
testRequest() is a function in the gin codebase, defined in gin_integration_test.go.
Where is testRequest() defined?
testRequest() is defined in gin_integration_test.go at line 31.
What calls testRequest()?
testRequest() is called by 9 function(s): TestEscapedColon, TestPusher, TestRunEmpty, TestRunEmptyWithEnv, TestRunQUIC, TestRunTLS, TestRunWithPort, TestTreeRunDynamicRouting, and 1 more.

Analyze Your Own Codebase

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

Try Supermodel Free