Skip to content

Commit

Permalink
cors edit
Browse files Browse the repository at this point in the history
  • Loading branch information
timurIsaevIY committed Sep 30, 2024
1 parent 2d80177 commit 66c91ec
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/pkg/middleware/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ func (c *CORSMiddleware) CorsMiddleware(next http.Handler) http.Handler {
if len(c.AllowedOrigins) > 0 {
w.Header().Set("Access-Control-Allow-Origin", c.AllowedOrigins[0])
}
if r.Method == http.MethodOptions {
w.WriteHeader(http.StatusOK)
return
}
next.ServeHTTP(w, r)
},
)
}

0 comments on commit 66c91ec

Please sign in to comment.