Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const Version = "0.1.0"
Version ...
Variables ¶
This section is empty.
Functions ¶
func Header ¶
Header returns the http.Header encoding of v.
Example ¶
type Options struct { ContentType string `header:"Content-Type"` Length int `header:"Length"` XArray []string `header:"X-Array"` TestHide string `header:"-"` IgnoreEmpty string `header:"X-Empty,omitempty"` IgnoreEmptyN string `header:"X-Empty-N,omitempty"` } opt := Options{ ContentType: "application/json", Length: 2, XArray: []string{"test1", "test2"}, TestHide: "hide", IgnoreEmptyN: "n", } h, _ := httpheader.Header(opt) fmt.Println(h["Content-Type"]) fmt.Println(h["Length"]) fmt.Println(h["X-Array"]) _, ok := h["TestHide"] fmt.Println(ok) _, ok = h["X-Empty"] fmt.Println(ok) fmt.Println(h["X-Empty-N"])
Output: [application/json] [2] [test1 test2] false false [n]
Types ¶
Click to show internal directories.
Click to hide internal directories.