Standard library / net/http
http.Header.Del()
Delete all values associated with the canonical header key. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (h Header) Del(key string)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | string | Header or query parameter name. |
Working Example
Example Snippetgo
package main
import ( "fmt" "net/http")
func main() { h := http.Header{} h.Set("X-Demo", "a") h.Del("x-demo") fmt.Println(h.Get("X-Demo") == "")}
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) }}