Merge pull request #3 from renannprado/master
Fix for #2 - handle preflight now doesn't write the headers anymore
This commit is contained in:
commit
75950c1a31
@ -41,6 +41,7 @@ func (cors *cors) applyCors(c *gin.Context) {
|
||||
|
||||
if c.Request.Method == "OPTIONS" {
|
||||
cors.handlePreflight(c)
|
||||
defer c.AbortWithStatus(200)
|
||||
} else {
|
||||
cors.handleNormal(c)
|
||||
}
|
||||
@ -66,7 +67,6 @@ func (cors *cors) validateOrigin(origin string) bool {
|
||||
}
|
||||
|
||||
func (cors *cors) handlePreflight(c *gin.Context) {
|
||||
c.AbortWithStatus(200)
|
||||
header := c.Writer.Header()
|
||||
for key, value := range cors.preflightHeaders {
|
||||
header[key] = value
|
||||
|
Loading…
Reference in New Issue
Block a user