Home / Function/ Test_Proxy_Modify_Request() — fiber Function Reference

Test_Proxy_Modify_Request() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

middleware/proxy/proxy_test.go lines 399–423

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

	_, addr := createProxyTestServerIPv4(t, func(c fiber.Ctx) error {
		b := c.Request().Body()
		return c.SendString(string(b))
	})

	app := fiber.New()
	app.Use(Balancer(Config{
		Servers: []string{addr},
		ModifyRequest: func(c fiber.Ctx) error {
			c.Request().SetBody([]byte("modified request"))
			return nil
		},
	}))

	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 request", string(b))
}

Domain

Subdomains

Frequently Asked Questions

What does Test_Proxy_Modify_Request() do?
Test_Proxy_Modify_Request() is a function in the fiber codebase, defined in middleware/proxy/proxy_test.go.
Where is Test_Proxy_Modify_Request() defined?
Test_Proxy_Modify_Request() is defined in middleware/proxy/proxy_test.go at line 399.
What does Test_Proxy_Modify_Request() call?
Test_Proxy_Modify_Request() 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