Home / Function/ Test_Proxy_Modify_Response() — fiber Function Reference

Test_Proxy_Modify_Response() — fiber Function Reference

Architecture documentation for the Test_Proxy_Modify_Response() function in proxy_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  362b50c5_fc55_4589_0587_e76b0008b2c8["Test_Proxy_Modify_Response()"]
  a7c70172_e40a_6ad6_65b6_b8f508cfb0a2["proxy_test.go"]
  362b50c5_fc55_4589_0587_e76b0008b2c8 -->|defined in| a7c70172_e40a_6ad6_65b6_b8f508cfb0a2
  52270b9b_26c8_081b_5239_bee723ca512a["createProxyTestServerIPv4()"]
  362b50c5_fc55_4589_0587_e76b0008b2c8 -->|calls| 52270b9b_26c8_081b_5239_bee723ca512a
  style 362b50c5_fc55_4589_0587_e76b0008b2c8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/proxy/proxy_test.go lines 373–396

func Test_Proxy_Modify_Response(t *testing.T) {
	t.Parallel()

	_, addr := createProxyTestServerIPv4(t, func(c fiber.Ctx) error {
		return c.Status(500).SendString("not modified")
	})

	app := fiber.New()
	app.Use(Balancer(Config{
		Servers: []string{addr},
		ModifyResponse: func(c fiber.Ctx) error {
			c.Response().SetStatusCode(fiber.StatusOK)
			return c.SendString("modified response")
		},
	}))

	resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody))
	require.NoError(t, err)
	require.Equal(t, fiber.StatusOK, resp.StatusCode)

	b, err := io.ReadAll(resp.Body)
	require.NoError(t, err)
	require.Equal(t, "modified response", string(b))
}

Domain

Subdomains

Frequently Asked Questions

What does Test_Proxy_Modify_Response() do?
Test_Proxy_Modify_Response() is a function in the fiber codebase, defined in middleware/proxy/proxy_test.go.
Where is Test_Proxy_Modify_Response() defined?
Test_Proxy_Modify_Response() is defined in middleware/proxy/proxy_test.go at line 373.
What does Test_Proxy_Modify_Response() call?
Test_Proxy_Modify_Response() calls 1 function(s): createProxyTestServerIPv4.

Analyze Your Own Codebase

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

Try Supermodel Free