MCPcopy
hub / github.com/gofiber/fiber / Test_Ctx_ProxyTrust_UnixRemoteAddr

Function Test_Ctx_ProxyTrust_UnixRemoteAddr

ctx_test.go:3679–3701  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3677}
3678
3679func Test_Ctx_ProxyTrust_UnixRemoteAddr(t *testing.T) {
3680 t.Parallel()
3681
3682 if runtime.GOOS == "windows" {
3683 t.Skip("unix sockets are not supported on windows in this test")
3684 }
3685
3686 t.Run("unix_socket_enabled", func(t *testing.T) {
3687 t.Parallel()
3688 parts := strings.SplitN(runCtxProxyTrustUnixRemoteAddrCase(t, true), "|", 2)
3689 require.Len(t, parts, 2)
3690 require.Equal(t, "true", parts[0])
3691 require.Equal(t, "1.1.1.1", parts[1])
3692 })
3693
3694 t.Run("unix_socket_disabled", func(t *testing.T) {
3695 t.Parallel()
3696 parts := strings.SplitN(runCtxProxyTrustUnixRemoteAddrCase(t, false), "|", 2)
3697 require.Len(t, parts, 2)
3698 require.Equal(t, "false", parts[0])
3699 require.Equal(t, "0.0.0.0", parts[1])
3700 })
3701}
3702
3703func runCtxProxyTrustUnixRemoteAddrCase(t *testing.T, unixSocket bool) string {
3704 t.Helper()

Callers

nothing calls this directly

Calls 2

LenMethod · 0.65

Tested by

no test coverage detected