TestNew | Basic middleware functionality with X-Forwarded headers | Correctly parses X-Forwarded-For, X-Forwarded-Proto, and X-Forwarded-Host |
TestWithOptions_TrustedProxies (trusted proxy) | Request from a trusted proxy IP | Honors X-Forwarded-For header and extracts client IP |
TestWithOptions_TrustedProxies (untrusted proxy) | Request from an untrusted proxy IP | Ignores X-Forwarded-For and uses RemoteAddr instead |
TestWithOptions_XForwardedForMultiple | Multiple IPs in X-Forwarded-For chain | Extracts the first (original client) IP from the chain |
TestWithOptions_ForwardedHeader | RFC 7239 Forwarded header parsing | Correctly parses for, proto, and host from Forwarded header |
TestFromContext | Alias function for Get() | FromContext returns same result as Get() |
TestClientIP | ClientIP helper function | Returns parsed client IP as net.IP |
TestProto (with header) | Protocol extraction with X-Forwarded-Proto | Returns “https” when header is present |
TestProto (without header) | Protocol extraction without header | Returns default “http” when no header present |
TestHost | Host extraction from X-Forwarded-Host | Returns forwarded host value |
TestWithOptions_DisableTrustProxy | TrustProxy disabled | Ignores all X-Forwarded headers and uses RemoteAddr |