Home / Function/ TestCollectHandlers_HTTPHandler() — fiber Function Reference

TestCollectHandlers_HTTPHandler() — fiber Function Reference

Architecture documentation for the TestCollectHandlers_HTTPHandler() function in adapter_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  64e63de6_e28a_1b6d_fdae_b282c68e263b["TestCollectHandlers_HTTPHandler()"]
  3ad7a4ef_7f07_008c_234d_52c9a342aa98["adapter_test.go"]
  64e63de6_e28a_1b6d_fdae_b282c68e263b -->|defined in| 3ad7a4ef_7f07_008c_234d_52c9a342aa98
  style 64e63de6_e28a_1b6d_fdae_b282c68e263b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

adapter_test.go lines 592–619

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

	var writeErr error
	httpHandler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
		w.Header().Set("X-HTTP", "ok")
		w.WriteHeader(http.StatusTeapot)
		_, writeErr = w.Write([]byte("http"))
	})

	handlers := collectHandlers("test", httpHandler)
	require.Len(t, handlers, 1)
	converted := handlers[0]
	require.NotNil(t, converted)

	app := New()
	ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
	t.Cleanup(func() {
		app.ReleaseCtx(ctx)
	})

	err := converted(ctx)
	require.NoError(t, err)
	require.Equal(t, http.StatusTeapot, ctx.Response().StatusCode())
	require.Equal(t, "ok", string(ctx.Response().Header.Peek("X-HTTP")))
	require.Equal(t, "http", string(ctx.Response().Body()))
	require.NoError(t, writeErr)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestCollectHandlers_HTTPHandler() do?
TestCollectHandlers_HTTPHandler() is a function in the fiber codebase, defined in adapter_test.go.
Where is TestCollectHandlers_HTTPHandler() defined?
TestCollectHandlers_HTTPHandler() is defined in adapter_test.go at line 592.

Analyze Your Own Codebase

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

Try Supermodel Free