Home / Function/ Test_HTTPHandler_App_Test_Interrupted() — fiber Function Reference

Test_HTTPHandler_App_Test_Interrupted() — fiber Function Reference

Architecture documentation for the Test_HTTPHandler_App_Test_Interrupted() function in adaptor_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  1b40acfa_53ed_e4bb_b104_c31df14f5fb3["Test_HTTPHandler_App_Test_Interrupted()"]
  8ec96b38_44b4_af66_6f6f_dd60f87b680c["adaptor_test.go"]
  1b40acfa_53ed_e4bb_b104_c31df14f5fb3 -->|defined in| 8ec96b38_44b4_af66_6f6f_dd60f87b680c
  style 1b40acfa_53ed_e4bb_b104_c31df14f5fb3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/adaptor/adaptor_test.go lines 236–260

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

	app := fiber.New()

	app.Get("/", HTTPHandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		flusher, ok := w.(http.Flusher)
		if !ok {
			t.Fatalf("w does not implement http.Flusher")
		}
		w.WriteHeader(fiber.StatusOK)
		fmt.Fprintf(w, "Hello ")
		flusher.Flush()
		time.Sleep(500 * time.Millisecond)
		fmt.Fprintf(w, "World!")
	}))

	resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody), fiber.TestConfig{
		Timeout:       200 * time.Millisecond,
		FailOnTimeout: true, // Changed to true to test interrupted behavior
	})
	// With FailOnTimeout: true, we should get a timeout error
	require.ErrorIs(t, err, os.ErrDeadlineExceeded)
	require.Nil(t, resp)
}

Domain

Subdomains

Frequently Asked Questions

What does Test_HTTPHandler_App_Test_Interrupted() do?
Test_HTTPHandler_App_Test_Interrupted() is a function in the fiber codebase, defined in middleware/adaptor/adaptor_test.go.
Where is Test_HTTPHandler_App_Test_Interrupted() defined?
Test_HTTPHandler_App_Test_Interrupted() is defined in middleware/adaptor/adaptor_test.go at line 236.

Analyze Your Own Codebase

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

Try Supermodel Free