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:
parent
9f50a659e9
commit
4cb5dc8522
@ -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)
|
||||
}
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user