Documentation ¶
Index ¶
- func Error(resp http.ResponseWriter, err string, code int)
- func ErrorCalc(resp http.ResponseWriter, err error)
- func GetErrorHttpStatus(err error) (string, int)
- func IsBadRequest(err error) (bool, string)
- func IsNotFoundError(err error) (bool, string)
- func LoadFromJson(req io.Reader, i interface{}) error
- func Marshal(resp http.ResponseWriter, statusCode int, result interface{})
- func Recover(g func(), message string)
- type CORSProvider
- type Config
- type ErrStruct
- type ErrorBadRequest
- type ErrorForbidden
- type ErrorInternalServerError
- type ErrorNotFound
- type ErrorUnauthorized
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorCalc ¶
func ErrorCalc(resp http.ResponseWriter, err error)
func GetErrorHttpStatus ¶
Checks for some known errors
func IsBadRequest ¶
func IsNotFoundError ¶
func LoadFromJson ¶
helper to load a provided pointer from json
func Marshal ¶
func Marshal(resp http.ResponseWriter, statusCode int, result interface{})
Marshal any Marshalable type
Types ¶
type CORSProvider ¶
type CORSProvider struct {
AllowOrigin string
}
CORSProvider can be used as middleware.
func (*CORSProvider) ServeHTTP ¶
func (cp *CORSProvider) ServeHTTP(resp http.ResponseWriter, req *http.Request, next http.HandlerFunc)
type ErrorBadRequest ¶
func (ErrorBadRequest) Error ¶
func (e ErrorBadRequest) Error() string
type ErrorForbidden ¶
func (ErrorForbidden) Error ¶
func (e ErrorForbidden) Error() string
type ErrorInternalServerError ¶
func (ErrorInternalServerError) Error ¶
func (e ErrorInternalServerError) Error() string
type ErrorNotFound ¶
func (ErrorNotFound) Error ¶
func (e ErrorNotFound) Error() string
type ErrorUnauthorized ¶
type ErrorUnauthorized struct {}
func (ErrorUnauthorized) Error ¶
func (e ErrorUnauthorized) Error() string
Click to show internal directories.
Click to hide internal directories.