Standard library / net/http
http.ResponseController.Flush()
Flushes buffered output when the writer supports flushing. Flushing does not guarantee delivery through intermediate proxies. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (c *ResponseController) Flush() errorReturn Value
error
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "fmt" "net/http" "net/http/httptest")
func main() { w := httptest.NewRecorder() check(http.NewResponseController(w).Flush()) fmt.Println(w.Flushed)}
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}