Home / Function/ Test_App_BodyLimit_Negative() — fiber Function Reference

Test_App_BodyLimit_Negative() — fiber Function Reference

Architecture documentation for the Test_App_BodyLimit_Negative() function in app_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  f4967e60_5f7a_3c25_81de_a6cf26c69a21["Test_App_BodyLimit_Negative()"]
  e728fdd2_242f_706b_c1d2_041b3d6badb5["app_test.go"]
  f4967e60_5f7a_3c25_81de_a6cf26c69a21 -->|defined in| e728fdd2_242f_706b_c1d2_041b3d6badb5
  style f4967e60_5f7a_3c25_81de_a6cf26c69a21 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

app_test.go lines 433–455

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

	limits := []int{-1, -512}
	for _, limit := range limits {
		app := New(Config{BodyLimit: limit})

		app.Post("/", func(c Ctx) error {
			return c.SendStatus(StatusOK)
		})

		largeBody := bytes.Repeat([]byte{'a'}, DefaultBodyLimit+1)
		req := httptest.NewRequest(MethodPost, "/", bytes.NewReader(largeBody))
		_, err := app.Test(req)
		require.ErrorIs(t, err, fasthttp.ErrBodyTooLarge)

		smallBody := bytes.Repeat([]byte{'a'}, DefaultBodyLimit-1)
		req = httptest.NewRequest(MethodPost, "/", bytes.NewReader(smallBody))
		resp, err := app.Test(req)
		require.NoError(t, err)
		require.Equal(t, StatusOK, resp.StatusCode)
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Test_App_BodyLimit_Negative() do?
Test_App_BodyLimit_Negative() is a function in the fiber codebase, defined in app_test.go.
Where is Test_App_BodyLimit_Negative() defined?
Test_App_BodyLimit_Negative() is defined in app_test.go at line 433.

Analyze Your Own Codebase

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

Try Supermodel Free