Skip to content

Commit

Permalink
allow PATCH
Browse files Browse the repository at this point in the history
  • Loading branch information
Raajheer1 committed Sep 1, 2024
1 parent 8f9c83a commit da31edf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/go-chi/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ package go_chi
import (
"github.com/VATUSA/primary-api/pkg/config"
"github.com/go-chi/cors"
log "github.com/sirupsen/logrus"
"strings"
)

func NewCors(cfg *config.Config) cors.Options {
allowedOrigins := strings.Split(cfg.Cors.AllowedOrigins, ",")
log.Debug("Allowed Origins: ", allowedOrigins)
return cors.Options{
AllowedOrigins: allowedOrigins,
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowedMethods: []string{"GET", "POST", "PATCH", "PUT", "DELETE", "OPTIONS"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "x-guest", "x-user", "x-api-key"},
AllowCredentials: true,
MaxAge: 300,
Expand Down

0 comments on commit da31edf

Please sign in to comment.