Documentation
¶
Overview ¶
This is the main interface file which defines the methods of the controller
Index ¶
- Variables
- func Index(w http.ResponseWriter, r *http.Request)
- type HTTPController
- func (c HTTPController) BadRequest(w http.ResponseWriter, err error, desc string, a ...interface{})
- func (c HTTPController) Error(w http.ResponseWriter, err error, errorCode int, description string, ...)
- func (c HTTPController) Error500(w http.ResponseWriter, err error, desc string, a ...interface{})
- func (c HTTPController) Forbidden(w http.ResponseWriter, err error, desc string, a ...interface{})
- func (c HTTPController) JSON(data interface{}, w http.ResponseWriter, r *http.Request)
- func (c HTTPController) NotFound(w http.ResponseWriter, err error, desc string, a ...interface{})
- func (c HTTPController) Plain(data string, w http.ResponseWriter, r *http.Request)
- func (c HTTPController) Redirect(code int, url string, w http.ResponseWriter, r *http.Request)
- func (c HTTPController) Render(tpl *template.Template, data interface{}, w http.ResponseWriter, ...)
Constants ¶
This section is empty.
Variables ¶
View Source
var Verbosity func(err error, format string, a ...interface{}) string
Verbosity returns an error string containing sensitive information when debug mode is activated or a more generic error message otherwise
Functions ¶
Types ¶
type HTTPController ¶
type HTTPController struct {
// contains filtered or unexported fields
}
func (HTTPController) BadRequest ¶
func (c HTTPController) BadRequest(w http.ResponseWriter, err error, desc string, a ...interface{})
func (HTTPController) Error ¶
func (c HTTPController) Error(w http.ResponseWriter, err error, errorCode int, description string, a ...interface{})
TODO (chaehni): Replace calls to error functions with this generic function. if used throughout, it makes the dedicated error functions obsolete.
func (HTTPController) Error500 ¶
func (c HTTPController) Error500(w http.ResponseWriter, err error, desc string, a ...interface{})
func (HTTPController) Forbidden ¶
func (c HTTPController) Forbidden(w http.ResponseWriter, err error, desc string, a ...interface{})
func (HTTPController) JSON ¶
func (c HTTPController) JSON(data interface{}, w http.ResponseWriter, r *http.Request)
func (HTTPController) NotFound ¶
func (c HTTPController) NotFound(w http.ResponseWriter, err error, desc string, a ...interface{})
func (HTTPController) Plain ¶
func (c HTTPController) Plain(data string, w http.ResponseWriter, r *http.Request)
func (HTTPController) Redirect ¶
func (c HTTPController) Redirect(code int, url string, w http.ResponseWriter, r *http.Request)
func (HTTPController) Render ¶
func (c HTTPController) Render(tpl *template.Template, data interface{}, w http.ResponseWriter, r *http.Request)
Directories
¶
Path | Synopsis |
---|---|
Package middleware provides a convenient way to chain http handlers.
|
Package middleware provides a convenient way to chain http handlers. |
Click to show internal directories.
Click to hide internal directories.