Documentation ¶
Index ¶
- func Error(w http.ResponseWriter, r *http.Request, code int, errorMessage string, ...)
- func JSON(l logrus.FieldLogger, w http.ResponseWriter, v interface{}, code int)
- func NewPanicFormatter(logger logrus.FieldLogger) negroni.PanicFormatter
- func Page(l logrus.FieldLogger, w http.ResponseWriter, tpl *template.Template, ...)
- func Template(l logrus.FieldLogger, w http.ResponseWriter, tpl *template.Template, ...)
- type ErrorPage
- type ErrorPageData
- type SessionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
func Error(w http.ResponseWriter, r *http.Request, code int, errorMessage string, fields logrus.Fields, err error)
Error displays the default error page.
func JSON ¶
func JSON(l logrus.FieldLogger, w http.ResponseWriter, v interface{}, code int)
JSON formats a JSON response.
func NewPanicFormatter ¶
func NewPanicFormatter(logger logrus.FieldLogger) negroni.PanicFormatter
NewPanicFormatter creates a formatter to display panics.
func Page ¶
func Page(l logrus.FieldLogger, w http.ResponseWriter, tpl *template.Template, title string, sess SessionInfo, access page.AccessChecker, bodyData interface{})
Page formats a page-type response.
A page-type response is supposed to be a subpage (see the page package), and it sets strict CSP.
func Template ¶
func Template(l logrus.FieldLogger, w http.ResponseWriter, tpl *template.Template, data interface{}, code int)
Template renders a html template.
Types ¶
type ErrorPage ¶
type ErrorPage struct {
// contains filtered or unexported fields
}
ErrorPage is an error page instance that will get rendered for the current request.
func DefaultErrorPage ¶
func DefaultErrorPage(logger logrus.FieldLogger) *ErrorPage
DefaultErrorPage creates the default error page.
func NewErrorPage ¶
func NewErrorPage(logger logrus.FieldLogger, tpl *template.Template) *ErrorPage
NewErrorPage creates a new ErrorPage.
func (*ErrorPage) FormatPanicError ¶
func (p *ErrorPage) FormatPanicError(w http.ResponseWriter, r *http.Request, infos *negroni.PanicInformation)
FormatPanicError formats a panic for Negroni.
type ErrorPageData ¶
ErrorPageData represents the data given to the error page template.
type SessionInfo ¶
SessionInfo stores important information about the session.
Click to show internal directories.
Click to hide internal directories.