Add warning when CORS feature is disabled. (#17)

Add PATCH and DELETE methods to CORS because we do expose some of those in our endpoints.

(cherry picked from commit 9445d93)
This commit is contained in:
mosen
2016-10-07 09:59:15 +11:00
committed by GitHub
parent a9959f7e30
commit a332f3cb75

View File

@@ -222,11 +222,13 @@ func main() {
c := cors.New(cors.Options{
AllowedOrigins: []string{*flCorsOrigin},
AllowCredentials: true,
AllowedMethods: []string{"GET", "POST", "PATCH", "DELETE"},
})
corsHandler := c.Handler(mux)
http.Handle("/", corsHandler)
} else {
logger.Log("warn", "CORS header is disabled")
http.Handle("/", mux)
}