feat(): adding HTTP PATCH support to API calls

Co-authored-by: Michael Vallaly <mike.vallaly@alphaeon.com>
This commit is contained in:
Michael Vallaly 2022-05-12 02:13:08 -05:00 committed by GitHub
parent 3559f1faea
commit bc1de4e5da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ func routes(conf *config.Config) Routes {
route(
"/",
index,
middlewares.UseBefore(middleware.Methods("GET", "POST"))...,
middlewares.UseBefore(middleware.Methods("GET", "PATCH", "POST"))...,
),
route(
staticPath,

View File

@ -8,7 +8,7 @@ import (
func Cors(inner 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", "POST, GET, OPTIONS")
w.Header().Set("Access-Control-Allow-Methods", "PATCH, POST, GET, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, Authorization")
if r.Method != "OPTIONS" {