Standard library / net/http
http.Pusher
Optional HTTP/2 push interface. A handler must check support and handle errors; a recorder does not implement it. Expected stdout: 'false\n'.
Formal Syntax & Structure
go syntaxgo
type Pusher interface { Push(target string, opts *PushOptions) error}Working Example
Example Snippetgo
package main
import ( "fmt" "net/http" "net/http/httptest")
func main() { var w http.ResponseWriter = httptest.NewRecorder() _, ok := w.(http.Pusher) fmt.Println(ok)}
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) }}