Home / Function/ Test_App_Test_ReadFail() — fiber Function Reference

Test_App_Test_ReadFail() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

app_test.go lines 2532–2562

func Test_App_Test_ReadFail(t *testing.T) {
	// Note: Test cannot run in parallel due to
	// overriding the httpReadResponse global variable.
	// t.Parallel()

	// Override httpReadResponse temporarily
	oldHTTPReadResponse := httpReadResponse
	defer func() {
		httpReadResponse = oldHTTPReadResponse
	}()

	httpReadResponse = func(r *bufio.Reader, req *http.Request) (*http.Response, error) {
		resp, err := http.ReadResponse(r, req)
		require.NoError(t, resp.Body.Close())
		resp.Body = errorReadCloser(0)
		return resp, err //nolint:wrapcheck // unnecessary to wrap it
	}

	app := New()
	hints := []string{"<https://cdn.com>; rel=preload; as=script"}
	app.Get("/early", func(c Ctx) error {
		err := c.SendEarlyHints(hints)
		require.NoError(t, err)
		return c.SendStatus(StatusOK)
	})

	req := httptest.NewRequest(MethodGet, "/early", http.NoBody)
	_, err := app.Test(req)

	require.ErrorIs(t, err, errInvalidReadOnBody)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free