1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 08:35:57 +01:00

Use methodNotAllowed in whip.

This commit is contained in:
Juliusz Chroboczek 2024-04-10 14:45:04 +02:00
parent f646191e01
commit 5753c46910

View file

@ -185,7 +185,7 @@ func whipEndpointHandler(w http.ResponseWriter, r *http.Request) {
} }
if r.Method != "POST" { if r.Method != "POST" {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed) methodNotAllowed(w, "OPTIONS", "POST")
return return
} }
@ -307,7 +307,7 @@ func whipResourceHandler(w http.ResponseWriter, r *http.Request) {
if r.Method == "OPTIONS" { if r.Method == "OPTIONS" {
w.Header().Set("Access-Control-Allow-Methods", w.Header().Set("Access-Control-Allow-Methods",
"OPTIONS, PATCH, DELETE", "OPTIONS, DELETE, PATCH",
) )
w.Header().Set("Access-Control-Allow-Headers", w.Header().Set("Access-Control-Allow-Headers",
"Authorization, Content-Type", "Authorization, Content-Type",
@ -321,7 +321,7 @@ func whipResourceHandler(w http.ResponseWriter, r *http.Request) {
} }
if r.Method != "PATCH" { if r.Method != "PATCH" {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed) methodNotAllowed(w, "OPTIONS", "DELETE", "PATCH")
return return
} }