From 5753c46910cf97beca08642c2d56c5b9b921566b Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Wed, 10 Apr 2024 14:45:04 +0200 Subject: [PATCH] Use methodNotAllowed in whip. --- webserver/whip.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webserver/whip.go b/webserver/whip.go index 15f69dc..0417558 100644 --- a/webserver/whip.go +++ b/webserver/whip.go @@ -185,7 +185,7 @@ func whipEndpointHandler(w http.ResponseWriter, r *http.Request) { } if r.Method != "POST" { - http.Error(w, "method not allowed", http.StatusMethodNotAllowed) + methodNotAllowed(w, "OPTIONS", "POST") return } @@ -307,7 +307,7 @@ func whipResourceHandler(w http.ResponseWriter, r *http.Request) { if r.Method == "OPTIONS" { w.Header().Set("Access-Control-Allow-Methods", - "OPTIONS, PATCH, DELETE", + "OPTIONS, DELETE, PATCH", ) w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type", @@ -321,7 +321,7 @@ func whipResourceHandler(w http.ResponseWriter, r *http.Request) { } if r.Method != "PATCH" { - http.Error(w, "method not allowed", http.StatusMethodNotAllowed) + methodNotAllowed(w, "OPTIONS", "DELETE", "PATCH") return }