1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 20:00:55 +00:00

multiple response.WriteHeader calls

This commit is contained in:
JessonChan 2016-02-24 10:31:44 +08:00
parent 2b23764ee0
commit 20301bc212

View File

@ -187,6 +187,10 @@ func (w *Response) Write(p []byte) (int, error) {
// WriteHeader sends an HTTP response header with status code,
// and sets `started` to true.
func (w *Response) WriteHeader(code int) {
if w.Status > 0 {
//prevent multiple response.WriteHeader calls
return
}
w.Status = code
w.Started = true
w.ResponseWriter.WriteHeader(code)