Home / Function/ Test_App_BodyLimit_LargerThanDefault() — fiber Function Reference

Test_App_BodyLimit_LargerThanDefault() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

app_test.go lines 478–500

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

	limit := DefaultBodyLimit*2 + 1024 // slightly above double the default
	app := New(Config{BodyLimit: limit})

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

	// Body larger than the default but within our custom limit should succeed
	midBody := bytes.Repeat([]byte{'a'}, DefaultBodyLimit+512)
	req := httptest.NewRequest(MethodPost, "/", bytes.NewReader(midBody))
	resp, err := app.Test(req)
	require.NoError(t, err)
	require.Equal(t, StatusOK, resp.StatusCode)

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

Domain

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free