Home / Function/ Test_Patch() — fiber Function Reference

Test_Patch() — fiber Function Reference

Architecture documentation for the Test_Patch() function in client_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  1ae2a311_30ec_c435_5a72_2c30ef983a96["Test_Patch()"]
  5d11d0f7_2b3b_7bf3_3b1d_76d79d6872a2["client_test.go"]
  1ae2a311_30ec_c435_5a72_2c30ef983a96 -->|defined in| 5d11d0f7_2b3b_7bf3_3b1d_76d79d6872a2
  d60625b6_c243_6c2d_ba86_cf99b49fb107["startTestServerWithPort()"]
  1ae2a311_30ec_c435_5a72_2c30ef983a96 -->|calls| d60625b6_c243_6c2d_ba86_cf99b49fb107
  style 1ae2a311_30ec_c435_5a72_2c30ef983a96 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

client/client_test.go lines 1172–1228

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

	setupApp := func() (*fiber.App, string) {
		app, addr := startTestServerWithPort(t, func(app *fiber.App) {
			app.Patch("/", func(c fiber.Ctx) error {
				return c.SendString(c.FormValue("foo"))
			})
		})

		return app, addr
	}

	t.Run("global patch function", func(t *testing.T) {
		t.Parallel()

		app, addr := setupApp()
		defer func() {
			require.NoError(t, app.Shutdown())
		}()

		time.Sleep(1 * time.Second)

		for range 5 {
			resp, err := Patch("http://"+addr, Config{
				FormData: map[string]string{
					"foo": "bar",
				},
			})

			require.NoError(t, err)
			require.Equal(t, fiber.StatusOK, resp.StatusCode())
			require.Equal(t, "bar", resp.String())
		}
	})

	t.Run("client patch", func(t *testing.T) {
		t.Parallel()

		app, addr := setupApp()
		defer func() {
			require.NoError(t, app.Shutdown())
		}()

		for range 5 {
			resp, err := New().Patch("http://"+addr, Config{
				FormData: map[string]string{
					"foo": "bar",
				},
			})

			require.NoError(t, err)
			require.Equal(t, fiber.StatusOK, resp.StatusCode())
			require.Equal(t, "bar", resp.String())
		}
	})
}

Domain

Subdomains

Frequently Asked Questions

What does Test_Patch() do?
Test_Patch() is a function in the fiber codebase, defined in client/client_test.go.
Where is Test_Patch() defined?
Test_Patch() is defined in client/client_test.go at line 1172.
What does Test_Patch() call?
Test_Patch() calls 1 function(s): startTestServerWithPort.

Analyze Your Own Codebase

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

Try Supermodel Free