mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 21:16:26 +01:00 
			
		
		
		
	Backport #15456 This PR simply checks the status before writing the header. Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		
							parent
							
								
									b28c3245cc
								
							
						
					
					
						commit
						00e55dd223
					
				@ -4,7 +4,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package context
 | 
					package context
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import "net/http"
 | 
					import (
 | 
				
			||||||
 | 
						"net/http"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ResponseWriter represents a response writer for HTTP
 | 
					// ResponseWriter represents a response writer for HTTP
 | 
				
			||||||
type ResponseWriter interface {
 | 
					type ResponseWriter interface {
 | 
				
			||||||
@ -60,8 +62,10 @@ func (r *Response) WriteHeader(statusCode int) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		r.beforeExecuted = true
 | 
							r.beforeExecuted = true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	r.status = statusCode
 | 
						if r.status == 0 {
 | 
				
			||||||
	r.ResponseWriter.WriteHeader(statusCode)
 | 
							r.status = statusCode
 | 
				
			||||||
 | 
							r.ResponseWriter.WriteHeader(statusCode)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Flush flush cached data
 | 
					// Flush flush cached data
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user