Home / Function/ Test_App_Errors() — fiber Function Reference

Test_App_Errors() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

app_test.go lines 409–431

func Test_App_Errors(t *testing.T) {
	t.Parallel()
	app := New(Config{
		BodyLimit: 4,
	})

	app.Get("/", func(_ Ctx) error {
		return errors.New("hi, i'm an error")
	})

	resp, err := app.Test(httptest.NewRequest(MethodGet, "/", http.NoBody))
	require.NoError(t, err, "app.Test(req)")
	require.Equal(t, 500, resp.StatusCode, "Status code")

	body, err := io.ReadAll(resp.Body)
	require.NoError(t, err)
	require.Equal(t, "hi, i'm an error", string(body))

	_, err = app.Test(httptest.NewRequest(MethodGet, "/", strings.NewReader("big body")))
	if err != nil {
		require.Equal(t, "body size exceeds the given limit", err.Error(), "app.Test(req)")
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free