1
0
mirror of https://github.com/labstack/echo.git synced 2025-05-29 23:17:34 +02:00

Revert "CORS: reject requests with 401 for non-preflight request with not mat…"

This reverts commit ee3e1297788e8fc3543489ebc0d4e940be7c6532.
This commit is contained in:
Martti T. 2025-05-22 14:11:27 +03:00 committed by GitHub
parent 9f50a659e9
commit 4cb5dc8522
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -262,7 +262,7 @@ func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc {
// Origin not allowed
if allowOrigin == "" {
if !preflight {
return echo.ErrUnauthorized
return next(c)
}
return c.NoContent(http.StatusNoContent)
}

View File

@ -525,7 +525,7 @@ func TestCorsHeaders(t *testing.T) {
allowedOrigin: "http://example.com",
method: http.MethodGet,
expected: false,
expectStatus: http.StatusUnauthorized,
expectStatus: http.StatusOK,
},
{
name: "non-preflight request, allow specific origin, matching origin header = CORS logic done",