Documentation ¶
Index ¶
- func GetUserInfo(r *http.Request) (user store.User, err error)
- func GetUserOrEmpty(r *http.Request) store.User
- func MustGetUserInfo(r *http.Request) store.User
- func SendErrorJSON(w http.ResponseWriter, r *http.Request, httpStatusCode int, err error, ...)
- func SetUserInfo(r *http.Request, user store.User) *http.Request
- type ErrCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUserInfo ¶
GetUserInfo returns user from request context
func GetUserOrEmpty ¶
GetUserOrEmpty attempts to get user info from request and returns empty object if failed
func MustGetUserInfo ¶
MustGetUserInfo fails if can't extract user data from the request. should be called from authed controllers only
func SendErrorJSON ¶
func SendErrorJSON(w http.ResponseWriter, r *http.Request, httpStatusCode int, err error, errMsg string, errCode ErrCode)
SendErrorJSON makes {error: blah, details: blah} json body and responds with error code
Types ¶
Click to show internal directories.
Click to hide internal directories.