Commit f36ceb1e authored by Sawood Alam's avatar Sawood Alam Committed by Steven Allen

Combine Allow headers in a single comma separated list

parent a29b26be
......@@ -5,6 +5,7 @@ import (
"errors"
"net/http"
"runtime/debug"
"strings"
"sync"
"time"
......@@ -192,10 +193,9 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
func setAllowedHeaders(w http.ResponseWriter, allowGet bool) {
w.Header().Add("Allow", http.MethodOptions)
w.Header().Add("Allow", http.MethodPost)
allowedMethods := []string{http.MethodOptions, http.MethodPost}
if allowGet {
w.Header().Add("Allow", http.MethodHead)
w.Header().Add("Allow", http.MethodGet)
allowedMethods = append(allowedMethods, http.MethodHead, http.MethodGet)
}
w.Header().Set("Allow", strings.Join(allowedMethods, ", "))
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment