|
|
@@ -25,19 +25,6 @@ func newMiddleware(s *storage.Storage) *middleware {
|
|
|
return &middleware{s}
|
|
|
}
|
|
|
|
|
|
-func (m *middleware) handleCORS(next http.Handler) http.Handler {
|
|
|
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
|
- w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
|
- w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
|
|
|
- w.Header().Set("Access-Control-Allow-Headers", "Authorization")
|
|
|
- if r.Method == http.MethodOptions {
|
|
|
- w.WriteHeader(http.StatusOK)
|
|
|
- return
|
|
|
- }
|
|
|
- next.ServeHTTP(w, r)
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
|
clientIP := request.ClientIP(r)
|