mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-03 19:17:29 -05:00 
			
		
		
		
	Merge pull request #737 from tw4452852/closeNotifier
http.CloseNotifier implementation for http.ResponseWriter wrapper
This commit is contained in:
		
						commit
						c4e2cf96e7
					
				@ -141,3 +141,12 @@ func (w *gzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
 | 
			
		||||
	}
 | 
			
		||||
	return nil, nil, fmt.Errorf("not a Hijacker")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CloseNotify implements http.CloseNotifier.
 | 
			
		||||
// It just inherits the underlying ResponseWriter's CloseNotify method.
 | 
			
		||||
func (w *gzipResponseWriter) CloseNotify() <-chan bool {
 | 
			
		||||
	if cn, ok := w.ResponseWriter.(http.CloseNotifier); ok {
 | 
			
		||||
		return cn.CloseNotify()
 | 
			
		||||
	}
 | 
			
		||||
	panic("not a CloseNotifier")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -87,3 +87,12 @@ func (r *ResponseRecorder) Flush() {
 | 
			
		||||
		panic("not a Flusher") // should be recovered at the beginning of middleware stack
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CloseNotify implements http.CloseNotifier.
 | 
			
		||||
// It just inherits the underlying ResponseWriter's CloseNotify method.
 | 
			
		||||
func (r *ResponseRecorder) CloseNotify() <-chan bool {
 | 
			
		||||
	if cn, ok := r.ResponseWriter.(http.CloseNotifier); ok {
 | 
			
		||||
		return cn.CloseNotify()
 | 
			
		||||
	}
 | 
			
		||||
	panic("not a CloseNotifier")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user