TestWithOptions_MissingToken | POST request without CAPTCHA token | Returns 400 Bad Request |
TestWithOptions_CustomVerifier (valid) | Custom verifier with valid token | Request proceeds (200 OK) |
TestWithOptions_CustomVerifier (invalid) | Custom verifier with invalid token | Returns 400 Bad Request |
TestWithOptions_SkipSafeMethods | GET request without token | Request proceeds (200 OK), CAPTCHA skipped |
TestWithOptions_SkipPaths | POST to path in SkipPaths | Request proceeds (200 OK), CAPTCHA skipped |
TestWithOptions_HeaderToken | Token provided via HTTP header | Token extracted from header, verification succeeds |
TestWithOptions_QueryToken | Token provided via query parameter | Token extracted from query, verification succeeds |
TestWithOptions_CustomErrorHandler | Invalid token with custom error handler | Custom handler returns 403 Forbidden with JSON |
TestCustom | Custom verifier function | Custom verification logic applied successfully |
TestNew | Creating middleware with New() | Middleware instance created with defaults |
TestErrors | Error message validation | All error types return correct messages |
TestExtractToken_InvalidLookup | TokenLookup without colon separator | Returns 400 Bad Request (token not found) |
TestVerifyToken_WithMockServer (valid) | Valid token verified by mock server | Returns 200 OK |
TestVerifyToken_WithMockServer (invalid) | Invalid token verified by mock server | Returns 400 Bad Request |
TestVerifyToken_RecaptchaV3Score (high) | reCAPTCHA v3 with score above threshold | Returns 200 OK |
TestVerifyToken_RecaptchaV3Score (low) | reCAPTCHA v3 with score below threshold | Returns 400 Bad Request |
TestVerifyToken_ServerError | Provider API returns 500 error | Returns 400 Bad Request |
TestVerifyToken_InvalidJSON | Provider returns malformed JSON | Returns 400 Bad Request |
TestVerifyToken_UnknownProvider | Unknown provider type | Returns 400 Bad Request |
TestGetClientIP_XForwardedFor | X-Forwarded-For header present | Extracts first IP from header, sends to provider |
TestGetClientIP_XRealIP | X-Real-IP header present | Extracts IP from header, sends to provider |
TestReCaptchaV2 | ReCaptchaV2 constructor | Creates middleware with reCAPTCHA v2 config |
TestReCaptchaV3 | ReCaptchaV3 constructor | Creates middleware with reCAPTCHA v3 config |
TestHCaptcha | HCaptcha constructor | Creates middleware with hCaptcha config |
TestTurnstile | Turnstile constructor | Creates middleware with Turnstile config |
TestWithOptions_VerifierError | Custom verifier returns error | Returns 400 Bad Request |
TestWithOptions_HeadMethod | HEAD request without token | Request proceeds (200 OK), CAPTCHA skipped |
TestWithOptions_OptionsMethod | OPTIONS request without token | Request proceeds (200 OK), CAPTCHA skipped |