TestNew | Basic middleware initialization | Creates middleware and sets CSRF cookie on GET request |
TestGetToken | Token retrieval from context | Token is stored in context and retrievable via GetToken() |
TestValidateTokenHeader | Token validation via header | POST request with valid token in header succeeds (200 OK) |
TestValidateTokenForm | Token validation via form field | POST request with valid token in form field succeeds (200 OK) |
TestMissingToken | Request without CSRF token | POST request without token returns 403 Forbidden |
TestInvalidToken | Request with invalid token | POST request with invalid token returns 403 Forbidden |
TestSkipPaths | Path exclusion from validation | Configured paths skip CSRF validation |
TestSkipMethods | HTTP method exclusion | Safe methods (GET, HEAD, OPTIONS) skip validation |
TestCustomErrorHandler | Custom error handling | Custom error handler returns JSON response on failure |
TestCustomCookieName | Custom cookie configuration | CSRF cookie uses configured custom name |
TestCustomHeaderName | Custom header configuration | Token validation accepts configured custom header name |
TestTokenHandler | Token endpoint handler | Token handler returns JSON with current CSRF token |
TestFormInput | HTML form input helper | Generates hidden input field with token value |
TestMetaTag | HTML meta tag helper | Generates meta tag with csrf-token name and value |
TestMaskUnmask | Token masking/unmasking | Masked token differs from original, unmask restores original |
TestFingerprint | Request fingerprinting | Same headers produce same fingerprint, different headers differ |