We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a29b26b commit f36ceb1Copy full SHA for f36ceb1
http/handler.go
@@ -5,6 +5,7 @@ import (
5
"errors"
6
"net/http"
7
"runtime/debug"
8
+ "strings"
9
"sync"
10
"time"
11
@@ -192,10 +193,9 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
192
193
}
194
195
func setAllowedHeaders(w http.ResponseWriter, allowGet bool) {
- w.Header().Add("Allow", http.MethodOptions)
196
- w.Header().Add("Allow", http.MethodPost)
+ allowedMethods := []string{http.MethodOptions, http.MethodPost}
197
if allowGet {
198
- w.Header().Add("Allow", http.MethodHead)
199
- w.Header().Add("Allow", http.MethodGet)
+ allowedMethods = append(allowedMethods, http.MethodHead, http.MethodGet)
200
+ w.Header().Set("Allow", strings.Join(allowedMethods, ", "))
201
0 commit comments