Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion middleware/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc {
// Origin not allowed
if allowOrigin == "" {
if !preflight {
return next(c)
return echo.ErrUnauthorized
}
return c.NoContent(http.StatusNoContent)
}
Expand Down
2 changes: 1 addition & 1 deletion middleware/cors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ func TestCorsHeaders(t *testing.T) {
allowedOrigin: "http://example.com",
method: http.MethodGet,
expected: false,
expectStatus: http.StatusOK,
expectStatus: http.StatusUnauthorized,
},
{
name: "non-preflight request, allow specific origin, matching origin header = CORS logic done",
Expand Down
Loading