Options requests are always accepted
All checks were successful
the build was successful

This commit is contained in:
Peter Stuifzand 2018-09-15 16:24:44 +02:00
parent 014898b8df
commit 83bcf0e708
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -60,6 +60,11 @@ func newPool(addr string) *redis.Pool {
func WithAuth(handler http.Handler, b *memoryBackend) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodOptions {
handler.ServeHTTP(w, r)
return
}
authorization := r.Header.Get("Authorization")
var token auth.TokenResponse