Home / Function/ Benchmark_Middleware_BasicAuth() — fiber Function Reference

Benchmark_Middleware_BasicAuth() — fiber Function Reference

Architecture documentation for the Benchmark_Middleware_BasicAuth() function in basicauth_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  f60f3e98_5aa9_88a1_b78f_7f6b0222a1d2["Benchmark_Middleware_BasicAuth()"]
  c1fa52c0_acd4_56de_8c46_542417f3c9b8["basicauth_test.go"]
  f60f3e98_5aa9_88a1_b78f_7f6b0222a1d2 -->|defined in| c1fa52c0_acd4_56de_8c46_542417f3c9b8
  bfd8a9b6_0e17_60de_7e62_37b7a2f1750e["sha256Hash()"]
  f60f3e98_5aa9_88a1_b78f_7f6b0222a1d2 -->|calls| bfd8a9b6_0e17_60de_7e62_37b7a2f1750e
  style f60f3e98_5aa9_88a1_b78f_7f6b0222a1d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/basicauth/basicauth_test.go lines 436–464

func Benchmark_Middleware_BasicAuth(b *testing.B) {
	app := fiber.New()

	hashedJohn := sha256Hash("doe")

	app.Use(New(Config{
		Users: map[string]string{
			"john": hashedJohn,
		},
	}))
	app.Get("/", func(c fiber.Ctx) error {
		return c.SendStatus(fiber.StatusTeapot)
	})

	h := app.Handler()

	fctx := &fasthttp.RequestCtx{}
	fctx.Request.Header.SetMethod(fiber.MethodGet)
	fctx.Request.SetRequestURI("/")
	fctx.Request.Header.Set(fiber.HeaderAuthorization, "basic am9objpkb2U=") // john:doe

	b.ReportAllocs()

	for b.Loop() {
		h(fctx)
	}

	require.Equal(b, fiber.StatusTeapot, fctx.Response.Header.StatusCode())
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does Benchmark_Middleware_BasicAuth() do?
Benchmark_Middleware_BasicAuth() is a function in the fiber codebase, defined in middleware/basicauth/basicauth_test.go.
Where is Benchmark_Middleware_BasicAuth() defined?
Benchmark_Middleware_BasicAuth() is defined in middleware/basicauth/basicauth_test.go at line 436.
What does Benchmark_Middleware_BasicAuth() call?
Benchmark_Middleware_BasicAuth() calls 1 function(s): sha256Hash.

Analyze Your Own Codebase

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

Try Supermodel Free