TestNew/allows matching origin | Request with allowed origin | Returns 200 OK with Access-Control-Allow-Origin header set to the matching origin |
TestNew/ignores non-matching origin | Request with non-allowed origin | Processes request normally but does not set CORS headers |
TestNew/handles preflight | OPTIONS request with origin | Returns 204 No Content with Access-Control-Allow-Methods and other preflight headers |
TestNew/ignores requests without origin | Request without Origin header | Processes request normally without setting any CORS headers |
TestAllowAll | AllowAll() with any origin | Sets Access-Control-Allow-Origin: * for any origin |
TestWithOrigins/http://a.com | WithOrigins() with allowed origin | Sets Access-Control-Allow-Origin to the specific allowed origin |
TestWithOrigins/http://b.com | WithOrigins() with another allowed origin | Sets Access-Control-Allow-Origin to the specific allowed origin |
TestWithOrigins/http://c.com | WithOrigins() with non-allowed origin | Does not set Access-Control-Allow-Origin header |
TestNew_AllowCredentials | Credentials enabled with specific origin | Sets Access-Control-Allow-Credentials: true and specific origin (not wildcard) |
TestNew_ExposeHeaders | Custom expose headers configured | Sets Access-Control-Expose-Headers with comma-separated header list |
TestNew_MaxAge | MaxAge set to 12 hours | Sets Access-Control-Max-Age: 43200 on preflight requests |
TestNew_AllowOriginFunc/http://example.com | Custom origin validator (exact match) | Allows the origin when validation function returns true |
TestNew_AllowOriginFunc/http://api.example.com | Custom origin validator (subdomain) | Allows subdomain when validation function returns true |
TestNew_AllowOriginFunc/http://other.com | Custom origin validator (non-matching) | Denies origin when validation function returns false |
TestNew_PrivateNetwork | Private Network Access enabled | Sets Access-Control-Allow-Private-Network: true when requested |
TestNew_VaryHeader | Specific origin configured | Adds Vary: Origin header to ensure proper caching |