1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-11 12:20:40 +00:00

fix the http: multiple response.WriteHeader calls

This commit is contained in:
astaxie
2015-08-28 23:08:00 +08:00
parent 306effa300
commit ad6547936e
2 changed files with 8 additions and 11 deletions

View File

@ -24,7 +24,7 @@
// // - PUT and PATCH methods
// // - Origin header
// // - Credentials share
// beego.InsertFilter("*", beego.BeforeRouter,cors.Allow(&cors.Options{
// beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
// AllowOrigins: []string{"https://*.foo.com"},
// AllowMethods: []string{"PUT", "PATCH"},
// AllowHeaders: []string{"Origin"},
@ -36,7 +36,6 @@
package cors
import (
"net/http"
"regexp"
"strconv"
"strings"
@ -216,8 +215,6 @@ func Allow(opts *Options) beego.FilterFunc {
for key, value := range headers {
ctx.Output.Header(key, value)
}
ctx.Output.SetStatus(http.StatusOK)
ctx.WriteString("")
return
}
headers = opts.Header(origin)