Home / Function/ Test_Extractors_Missing() — fiber Function Reference

Test_Extractors_Missing() — fiber Function Reference

Architecture documentation for the Test_Extractors_Missing() function in extractors_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  84c6c115_89c0_0f70_acfd_5d6dbc2d8eb8["Test_Extractors_Missing()"]
  cf5e296e_8db5_6f84_b05a_9c0cac6f83e7["extractors_test.go"]
  84c6c115_89c0_0f70_acfd_5d6dbc2d8eb8 -->|defined in| cf5e296e_8db5_6f84_b05a_9c0cac6f83e7
  564f4da6_d93f_44ce_5143_1a130449b5d9["newRequest()"]
  84c6c115_89c0_0f70_acfd_5d6dbc2d8eb8 -->|calls| 564f4da6_d93f_44ce_5143_1a130449b5d9
  style 84c6c115_89c0_0f70_acfd_5d6dbc2d8eb8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

extractors/extractors_test.go lines 15–56

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

	app := fiber.New()
	// Add a route to test the missing param
	app.Get("/test", func(c fiber.Ctx) error {
		token, err := FromParam("token").Extract(c)
		require.Empty(t, token)
		require.ErrorIs(t, err, ErrNotFound)
		return nil
	})
	_, err := app.Test(newRequest(fiber.MethodGet, "/test"))
	require.NoError(t, err)

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

	// Missing form
	token, err := FromForm("token").Extract(ctx)
	require.Empty(t, token)
	require.ErrorIs(t, err, ErrNotFound)

	// Missing query
	token, err = FromQuery("token").Extract(ctx)
	require.Empty(t, token)
	require.ErrorIs(t, err, ErrNotFound)

	// Missing header
	token, err = FromHeader("X-Token").Extract(ctx)
	require.Empty(t, token)
	require.ErrorIs(t, err, ErrNotFound)

	// Missing Auth header
	token, err = FromAuthHeader("Bearer").Extract(ctx)
	require.Empty(t, token)
	require.ErrorIs(t, err, ErrNotFound)

	// Missing cookie
	token, err = FromCookie("token").Extract(ctx)
	require.Empty(t, token)
	require.ErrorIs(t, err, ErrNotFound)
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does Test_Extractors_Missing() do?
Test_Extractors_Missing() is a function in the fiber codebase, defined in extractors/extractors_test.go.
Where is Test_Extractors_Missing() defined?
Test_Extractors_Missing() is defined in extractors/extractors_test.go at line 15.
What does Test_Extractors_Missing() call?
Test_Extractors_Missing() calls 1 function(s): newRequest.

Analyze Your Own Codebase

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

Try Supermodel Free