mirror of
https://github.com/jech/galene.git
synced 2024-11-09 18:25:58 +01:00
Implement methodNotAllowed.
This commit is contained in:
parent
fc6387bb38
commit
f646191e01
1 changed files with 13 additions and 1 deletions
|
@ -145,6 +145,18 @@ func httpError(w http.ResponseWriter, err error) {
|
|||
http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
func methodNotAllowed(w http.ResponseWriter, methods ...string) {
|
||||
ms := ""
|
||||
for _, m := range methods {
|
||||
if ms != "" {
|
||||
ms = ms + ", "
|
||||
}
|
||||
ms = ms + m
|
||||
}
|
||||
w.Header().Set("Allow", ms)
|
||||
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||||
}
|
||||
|
||||
const (
|
||||
normalCacheControl = "max-age=1800"
|
||||
veryCachableCacheControl = "max-age=86400"
|
||||
|
@ -615,7 +627,7 @@ func recordingsHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
func handleGroupAction(w http.ResponseWriter, r *http.Request, group string) {
|
||||
if r.Method != "POST" {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
methodNotAllowed(w, "POST")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue