Standard library / net/http

http.PushOptions

Specifies method and additional headers for HTTP/2 push. Method defaults to GET; only GET or HEAD are permitted. Support is not guaranteed. Expected stdout: 'HEAD text/plain\n'.

Formal Syntax & Structure

go syntaxgo
type PushOptions struct {  Method string
  Header Header}

Working Example

Example Snippetgo
package main
import (  "fmt"  "net/http")
func main() {  o := http.PushOptions{Method: http.MethodHead, Header: http.Header{"Accept": {"text/plain"}}}  fmt.Println(o.Method, o.Header.Get("Accept"))}
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)  }}
Go Reference