Documentation ¶
Overview ¶
Package httpheader provides a Bind function, which binds HTTP header values to struct fields.
Example:
package main import ( "fmt" "github.com/dennisstritzke/httpheader" "net/http" ) type GitHubResponse struct { Date string `header:"Date"` } func main() { resp, _ := http.Get("https://github.com/") var githubResponse GitHubResponse err := httpheader.Bind(resp.Header, &githubResponse) if err != nil { fmt.Println(err) return } fmt.Printf("Date: %s\n", githubResponse.Date) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type InvalidBindError ¶
An InvalidBindError describes an invalid argument passed to Bind. (The argument to Bind must be a non-nil pointer.)
func (*InvalidBindError) Error ¶
func (e *InvalidBindError) Error() string
Click to show internal directories.
Click to hide internal directories.