Documentation
¶
Overview ¶
Package req provides a convenient wrapper around http.Request.
Index ¶
- Variables
- func Context(r *http.Request) context.Context
- func Cookie(r *http.Request, name string) (*http.Cookie, error)
- func Cookies(r *http.Request) []*http.Cookie
- func File(r *http.Request, a any) error
- func FileValue(r *http.Request, key string) (string, []byte, error)
- func Form(r *http.Request, a any) error
- func FormValue(r *http.Request, key string) (string, error)
- func Header(r *http.Request, key string) (string, error)
- func Headers(r *http.Request) http.Header
- func ID(r *http.Request) int
- func Json(r *http.Request, a any) error
- func Query(r *http.Request, a any) error
- func QueryValue(r *http.Request, key string) (string, error)
- func Session(r *http.Request) (*session.Session, error)
- func Var(r *http.Request, key string) string
- func Vars(r *http.Request) map[string]string
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Cookie ¶
Cookie returns the named cookie provided in the request or ErrNoCookie if not found. If multiple cookies match the given name, only one cookie will be returned.
func File ¶
File parses multipart form returns the first file associated with the `file` key. Filename (*string) and File ([]byte) fields are used to store file name and data.
func FileValue ¶
FileValue parses multipart form returns the first file associated with the given key.
func Form ¶
Form parses the raw query from the url.URL and decodes it to a struct. The tag `req` is used to locate custom field aliases.
func FormValue ¶
FormValue returns the first value for the named component of the POST, PUT, or PATCH request body.
func Header ¶
Header returns the first value associated with the given key. If there are no values associated with the key, Header returns "".
func Query ¶
Query parses url.RawQuery and decodes the corresponding values to a struct. The tag `query` is used to locate custom field aliases.
func QueryValue ¶
QueryValue parses url.RawQuery and returns the first value associated with the given key. If there are no values associated with the key, QueryValue returns the empty string.
Types ¶
This section is empty.