Added CORS to header to OPTIONS request

This commit is contained in:
Brad Rydzewski 2016-02-05 13:04:46 -08:00
parent 158295d02a
commit e018a34711

View file

@ -25,6 +25,7 @@ func Options(c *gin.Context) {
if c.Request.Method != "OPTIONS" { if c.Request.Method != "OPTIONS" {
c.Next() c.Next()
} else { } else {
c.Header("Access-Control-Allow-Origin", "*")
c.Header("Access-Control-Allow-Methods", "GET,POST,PUT,PATCH,DELETE,OPTIONS") c.Header("Access-Control-Allow-Methods", "GET,POST,PUT,PATCH,DELETE,OPTIONS")
c.Header("Access-Control-Allow-Headers", "Authorization") c.Header("Access-Control-Allow-Headers", "Authorization")
c.Header("Allow", "HEAD,GET,POST,PUT,PATCH,DELETE,OPTIONS") c.Header("Allow", "HEAD,GET,POST,PUT,PATCH,DELETE,OPTIONS")