Home / Function/ Test_FiberHandler_WithUnixSocket() — fiber Function Reference

Test_FiberHandler_WithUnixSocket() — fiber Function Reference

Architecture documentation for the Test_FiberHandler_WithUnixSocket() function in adaptor_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  cee85ac9_2e4d_6a0f_d8a1_08247477a9c1["Test_FiberHandler_WithUnixSocket()"]
  8ec96b38_44b4_af66_6f6f_dd60f87b680c["adaptor_test.go"]
  cee85ac9_2e4d_6a0f_d8a1_08247477a9c1 -->|defined in| 8ec96b38_44b4_af66_6f6f_dd60f87b680c
  style cee85ac9_2e4d_6a0f_d8a1_08247477a9c1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/adaptor/adaptor_test.go lines 1389–1416

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

	// Test case where request has unix socket context
	fiberH := func(c fiber.Ctx) error {
		return c.SendString("unix socket success")
	}
	handlerFunc := FiberHandlerFunc(fiberH)

	// Create a context with unix socket local address
	unixAddr := &net.UnixAddr{Name: "/tmp/test.sock", Net: "unix"}
	ctx := context.WithValue(context.Background(), http.LocalAddrContextKey, unixAddr)

	r := &http.Request{
		Method:     http.MethodGet,
		RequestURI: "/test",
		RemoteAddr: "someremoteaddr", // This will be ignored due to unix socket
		Header:     make(http.Header),
		Body:       http.NoBody,
	}
	r = r.WithContext(ctx)

	w := &netHTTPResponseWriter{}
	handlerFunc.ServeHTTP(w, r)

	require.Equal(t, http.StatusOK, w.StatusCode())
	require.Equal(t, "unix socket success", string(w.body))
}

Domain

Subdomains

Frequently Asked Questions

What does Test_FiberHandler_WithUnixSocket() do?
Test_FiberHandler_WithUnixSocket() is a function in the fiber codebase, defined in middleware/adaptor/adaptor_test.go.
Where is Test_FiberHandler_WithUnixSocket() defined?
Test_FiberHandler_WithUnixSocket() is defined in middleware/adaptor/adaptor_test.go at line 1389.

Analyze Your Own Codebase

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

Try Supermodel Free