mirror of
https://github.com/astaxie/beego.git
synced 2024-12-22 23:20:48 +00:00
multiple response.WriteHeader calls
This commit is contained in:
parent
2b23764ee0
commit
20301bc212
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user