Home / Function/ TestCollectHandlers_FasthttpHandler() — fiber Function Reference

TestCollectHandlers_FasthttpHandler() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

adapter_test.go lines 888–917

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

	before := func(c Ctx) error {
		c.Set("X-Before", "fiber")
		return nil
	}

	fasthttpHandler := fasthttp.RequestHandler(func(ctx *fasthttp.RequestCtx) {
		ctx.Response.Header.Set("X-FASTHTTP", "ok")
		ctx.SetBody([]byte("done"))
	})

	handlers := collectHandlers("fasthttp", before, fasthttpHandler)
	require.Len(t, handlers, 2)

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

	for _, handler := range handlers {
		require.NoError(t, handler(ctx))
	}

	require.Equal(t, "fiber", string(ctx.Response().Header.Peek("X-Before")))
	require.Equal(t, "ok", string(ctx.Response().Header.Peek("X-FASTHTTP")))
	require.Equal(t, "done", string(ctx.Response().Body()))
}

Domain

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free