From ef05c6943814d5851cd8a890ecb05cf715cd0bec Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 31 Dec 2023 04:37:47 +0100 Subject: Fixed missing OPTIONS that's also allowed --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 991c54a..f2cb460 100644 --- a/main.go +++ b/main.go @@ -14,14 +14,14 @@ func handleHome(w http.ResponseWriter, r *http.Request) { func handleEntryOptions(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") - w.Header().Set("Access-Control-Allow-Methods", "POST") + w.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS") w.Header().Set("Access-Control-Allow-Headers", "Content-Type") w.WriteHeader(http.StatusNoContent) } func handleEntryPost(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") - w.Header().Set("Access-Control-Allow-Methods", "POST") + w.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS") w.Header().Set("Access-Control-Allow-Headers", "Content-Type") var entry Entry -- cgit v1.1