Home / Function/ Test_NextCustom_MethodNotAllowed() — fiber Function Reference

Test_NextCustom_MethodNotAllowed() — fiber Function Reference

Architecture documentation for the Test_NextCustom_MethodNotAllowed() function in router_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  c2f063b6_2841_e527_034a_a600f3fdd433["Test_NextCustom_MethodNotAllowed()"]
  326d7e00_9e4f_d854_0c78_b9c0c93e5537["router_test.go"]
  c2f063b6_2841_e527_034a_a600f3fdd433 -->|defined in| 326d7e00_9e4f_d854_0c78_b9c0c93e5537
  c4f82a93_8940_d363_0257_1b9cc4cd3148["newCustomApp()"]
  c2f063b6_2841_e527_034a_a600f3fdd433 -->|calls| c4f82a93_8940_d363_0257_1b9cc4cd3148
  style c2f063b6_2841_e527_034a_a600f3fdd433 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

router_test.go lines 1933–1956

func Test_NextCustom_MethodNotAllowed(t *testing.T) {
	t.Parallel()
	app := newCustomApp()
	app.Get("/foo", func(c Ctx) error { return c.SendStatus(StatusOK) })
	useRoute := &Route{use: true, path: "/foo", Path: "/foo", routeParser: parseRoute("/foo")}
	m := app.methodInt(MethodGet)
	app.stack[m] = append([]*Route{useRoute}, app.stack[m]...)
	app.routesRefreshed = true
	app.ensureAutoHeadRoutes()
	app.RebuildTree()

	fctx := &fasthttp.RequestCtx{}
	fctx.Request.Header.SetMethod(MethodPost)
	fctx.Request.SetRequestURI("/foo")

	ctx := app.AcquireCtx(fctx)
	defer app.ReleaseCtx(ctx)

	matched, err := app.nextCustom(ctx)
	require.False(t, matched)
	require.ErrorIs(t, err, ErrMethodNotAllowed)
	allow := string(ctx.Response().Header.Peek(HeaderAllow))
	require.Equal(t, "GET, HEAD", allow)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Test_NextCustom_MethodNotAllowed() do?
Test_NextCustom_MethodNotAllowed() is a function in the fiber codebase, defined in router_test.go.
Where is Test_NextCustom_MethodNotAllowed() defined?
Test_NextCustom_MethodNotAllowed() is defined in router_test.go at line 1933.
What does Test_NextCustom_MethodNotAllowed() call?
Test_NextCustom_MethodNotAllowed() calls 1 function(s): newCustomApp.

Analyze Your Own Codebase

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

Try Supermodel Free