Home / Function/ Test_TokenFromContext_None() — fiber Function Reference

Test_TokenFromContext_None() — fiber Function Reference

Architecture documentation for the Test_TokenFromContext_None() function in keyauth_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  90248c3f_414c_4e6c_7f00_4b53f16cf981["Test_TokenFromContext_None()"]
  71f55784_a001_0646_0ce7_7ad97067c49c["keyauth_test.go"]
  90248c3f_414c_4e6c_7f00_4b53f16cf981 -->|defined in| 71f55784_a001_0646_0ce7_7ad97067c49c
  style 90248c3f_414c_4e6c_7f00_4b53f16cf981 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/keyauth/keyauth_test.go lines 507–524

func Test_TokenFromContext_None(t *testing.T) {
	app := fiber.New()
	// Define a test handler that checks TokenFromContext
	app.Get("/", func(c fiber.Ctx) error {
		return c.SendString(TokenFromContext(c))
	})

	// Verify a "" is sent back if nothing sets the token on the context.
	req := httptest.NewRequest(fiber.MethodGet, "/", http.NoBody)
	// Send
	res, err := app.Test(req)
	require.NoError(t, err)

	// Read the response body into a string
	body, err := io.ReadAll(res.Body)
	require.NoError(t, err)
	require.Empty(t, body)
}

Domain

Subdomains

Frequently Asked Questions

What does Test_TokenFromContext_None() do?
Test_TokenFromContext_None() is a function in the fiber codebase, defined in middleware/keyauth/keyauth_test.go.
Where is Test_TokenFromContext_None() defined?
Test_TokenFromContext_None() is defined in middleware/keyauth/keyauth_test.go at line 507.

Analyze Your Own Codebase

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

Try Supermodel Free