Standard library / net/http
http.ResponseController.EnableFullDuplex()
Enables interleaved reading and writing for HTTP/1 when supported; HTTP/2 already allows this. Here the recorder lacks support. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (c *ResponseController) EnableFullDuplex() errorReturn Value
error
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "errors" "fmt" "net/http" "net/http/httptest")
func main() { e := http.NewResponseController(httptest.NewRecorder()).EnableFullDuplex() fmt.Println(errors.Is(e, http.ErrNotSupported))}
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) }}