Documentation
¶
Index ¶
- func NotFoundHandler() http.Handler
- func TokenFromHeader(r *http.Request) string
- func WriteBadRequest(w http.ResponseWriter, details interface{})
- func WriteCreated(w http.ResponseWriter, data, meta interface{})
- func WriteInternalError(w http.ResponseWriter, details interface{})
- func WriteNoContent(w http.ResponseWriter)
- func WriteNotFound(w http.ResponseWriter, details interface{})
- func WriteOK(w http.ResponseWriter, data, meta interface{})
- func WriteResponse(w http.ResponseWriter, code int, body interface{})
- func WriteUnauthorized(w http.ResponseWriter, details interface{})
- func WriteValidationError(w http.ResponseWriter, err error)
- type DataResponse
- type ErrorResponse
- type ErrorResponseError
- type SPAHandler
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TokenFromHeader ¶ added in v1.0.22
TokenFromHeader func
func WriteBadRequest ¶
func WriteBadRequest(w http.ResponseWriter, details interface{})
WriteBadRequest writes 400 response
func WriteCreated ¶
func WriteCreated(w http.ResponseWriter, data, meta interface{})
WriteCreated writes 201 response
func WriteInternalError ¶
func WriteInternalError(w http.ResponseWriter, details interface{})
WriteInternalError writes 500 response
func WriteNotFound ¶
func WriteNotFound(w http.ResponseWriter, details interface{})
WriteNotFound writes 404 response
func WriteOK ¶
func WriteOK(w http.ResponseWriter, data, meta interface{})
WriteOK writes 200 response
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, code int, body interface{})
WriteResponse func
func WriteUnauthorized ¶
func WriteUnauthorized(w http.ResponseWriter, details interface{})
WriteUnauthorized writes 401 response
func WriteValidationError ¶ added in v1.0.10
func WriteValidationError(w http.ResponseWriter, err error)
WriteValidationError writes 400 or 500 response
Types ¶
type DataResponse ¶
type DataResponse struct { Data interface{} `json:"data"` Meta interface{} `json:"meta,omitempty"` }
DataResponse struct
func NewDataResponse ¶
func NewDataResponse(data, meta interface{}) *DataResponse
NewDataResponse func
type ErrorResponse ¶
type ErrorResponse struct {
Error ErrorResponseError `json:"error"`
}
ErrorResponse struct
func NewErrorResponse ¶
func NewErrorResponse(code string, details interface{}) *ErrorResponse
NewErrorResponse func
type ErrorResponseError ¶
type ErrorResponseError struct { Code string `json:"code"` Details interface{} `json:"details,omitempty"` }
ErrorResponseError struct
type SPAHandler ¶ added in v1.0.21
type SPAHandler struct {
// contains filtered or unexported fields
}
func NewSPAHandler ¶ added in v1.0.21
func (*SPAHandler) ServeHTTP ¶ added in v1.0.21
func (h *SPAHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ValidationError ¶
ValidationError error
func NewValidationError ¶
func NewValidationError(errorMap map[string]string) *ValidationError
NewValidationError func
Source Files
¶
Click to show internal directories.
Click to hide internal directories.