Documentation
¶
Index ¶
- Constants
- func ExtentionStatusText(code int) string
- func ReadParams(r *http.Request) (map[string]interface{}, error)
- func RequireFormParams(r *http.Request, params []string) error
- func RequireParams(form url.Values, params []string) error
- func ServeError(w http.ResponseWriter, errRes ErrorResponse)
- func ServeJSON(w http.ResponseWriter, v interface{})
- type ErrorResponse
Constants ¶
View Source
const (
StatusUnprocessableEntity = 422
)
Variables ¶
This section is empty.
Functions ¶
func ExtentionStatusText ¶
func ReadParams ¶
ReadParams reads in parameters from the request, using the content type.
func ServeError ¶
func ServeError(w http.ResponseWriter, errRes ErrorResponse)
func ServeJSON ¶
func ServeJSON(w http.ResponseWriter, v interface{})
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Status int `json:"status"`
Message string `json:"message"`
StatusText string `json:"error"`
}
func NewErrorResponse ¶
func NewErrorResponse(status int, message string) ErrorResponse
func (ErrorResponse) Error ¶
func (T ErrorResponse) Error() string
Click to show internal directories.
Click to hide internal directories.