Documentation
¶
Index ¶
- Constants
- Variables
- func LivenessHandler(w http.ResponseWriter, r *http.Request)
- func MethodNotAllowedHandler(w http.ResponseWriter, _r *http.Request)
- func NotFoundHandler(w http.ResponseWriter, _r *http.Request)
- func SendBadGateway(rw http.ResponseWriter, details ErrorDetails)
- func SendBadRequest(rw http.ResponseWriter, details ErrorDetails)
- func SendConflict(rw http.ResponseWriter, details ErrorDetails)
- func SendExpectationFailed(rw http.ResponseWriter, details ErrorDetails)
- func SendForbidden(rw http.ResponseWriter, details ErrorDetails)
- func SendGatewayTimeout(rw http.ResponseWriter, details ErrorDetails)
- func SendGone(rw http.ResponseWriter, details ErrorDetails)
- func SendHTTPVersionNotSupported(rw http.ResponseWriter, details ErrorDetails)
- func SendInternalServerError(rw http.ResponseWriter, details ErrorDetails)
- func SendJson(rw http.ResponseWriter, response []byte)
- func SendLengthRequired(rw http.ResponseWriter, details ErrorDetails)
- func SendMethodNotAllowed(rw http.ResponseWriter, details ErrorDetails)
- func SendNotAcceptable(rw http.ResponseWriter, details ErrorDetails)
- func SendNotFound(rw http.ResponseWriter, details ErrorDetails)
- func SendNotImplemented(rw http.ResponseWriter, details ErrorDetails)
- func SendPayloadTooLarge(rw http.ResponseWriter, details ErrorDetails)
- func SendPreconditionFailed(rw http.ResponseWriter, details ErrorDetails)
- func SendRangeNotSatisfiable(rw http.ResponseWriter, details ErrorDetails)
- func SendRequestTimeout(rw http.ResponseWriter, details ErrorDetails)
- func SendServiceUnavailable(rw http.ResponseWriter, details ErrorDetails)
- func SendStructAsJson(rw http.ResponseWriter, v interface{})
- func SendText(rw http.ResponseWriter, response string)
- func SendTooManyRequests(rw http.ResponseWriter, details ErrorDetails)
- func SendURITooLong(rw http.ResponseWriter, details ErrorDetails)
- func SendUnauthorized(rw http.ResponseWriter, details ErrorDetails)
- func SendUnprocessableEntity(rw http.ResponseWriter, details ErrorDetails)
- func SendUnsupportedMediaType(rw http.ResponseWriter, details ErrorDetails)
- func SendValidationError(rw http.ResponseWriter, details ErrorDetails)
- func ValidatingHandler[T any](handler func(http.ResponseWriter, *http.Request, *T)) func(w http.ResponseWriter, r *http.Request)
- type ErrorDetails
- type HttpError
Constants ¶
View Source
const ( HeaderContentType = "Content-Type" ContentTypeText = "text/plain; charset=utf-8" ContentTypeJson = "application/json" ContentTypeProblemJson = "application/problem+json" )
Variables ¶
View Source
var EMPTY_MAP = make(map[string]map[string]string)
Functions ¶
func LivenessHandler ¶ added in v1.1.0
func LivenessHandler(w http.ResponseWriter, r *http.Request)
func MethodNotAllowedHandler ¶
func MethodNotAllowedHandler(w http.ResponseWriter, _r *http.Request)
func NotFoundHandler ¶
func NotFoundHandler(w http.ResponseWriter, _r *http.Request)
func SendBadGateway ¶
func SendBadGateway(rw http.ResponseWriter, details ErrorDetails)
502 Bad Gateway
func SendBadRequest ¶
func SendBadRequest(rw http.ResponseWriter, details ErrorDetails)
400 Bad Request
func SendExpectationFailed ¶
func SendExpectationFailed(rw http.ResponseWriter, details ErrorDetails)
417 Expectation Failed
func SendGatewayTimeout ¶
func SendGatewayTimeout(rw http.ResponseWriter, details ErrorDetails)
504 Gateway Timeout
func SendHTTPVersionNotSupported ¶
func SendHTTPVersionNotSupported(rw http.ResponseWriter, details ErrorDetails)
505 HTTP Version Not Supported
func SendInternalServerError ¶
func SendInternalServerError(rw http.ResponseWriter, details ErrorDetails)
500 Internal Server Error
func SendJson ¶
func SendJson(rw http.ResponseWriter, response []byte)
func SendLengthRequired ¶
func SendLengthRequired(rw http.ResponseWriter, details ErrorDetails)
411 Length Required
func SendMethodNotAllowed ¶
func SendMethodNotAllowed(rw http.ResponseWriter, details ErrorDetails)
405 Method Not Allowed
func SendNotAcceptable ¶
func SendNotAcceptable(rw http.ResponseWriter, details ErrorDetails)
406 Not Acceptable
func SendNotImplemented ¶
func SendNotImplemented(rw http.ResponseWriter, details ErrorDetails)
501 Not Implemented
func SendPayloadTooLarge ¶
func SendPayloadTooLarge(rw http.ResponseWriter, details ErrorDetails)
413 Payload Too Large
func SendPreconditionFailed ¶
func SendPreconditionFailed(rw http.ResponseWriter, details ErrorDetails)
412 Precondition Failed
func SendRangeNotSatisfiable ¶
func SendRangeNotSatisfiable(rw http.ResponseWriter, details ErrorDetails)
416 Range Not Satisfiable
func SendRequestTimeout ¶
func SendRequestTimeout(rw http.ResponseWriter, details ErrorDetails)
408 Request Timeout
func SendServiceUnavailable ¶
func SendServiceUnavailable(rw http.ResponseWriter, details ErrorDetails)
503 Service Unavailable
func SendStructAsJson ¶ added in v1.4.0
func SendStructAsJson(rw http.ResponseWriter, v interface{})
func SendText ¶
func SendText(rw http.ResponseWriter, response string)
func SendTooManyRequests ¶
func SendTooManyRequests(rw http.ResponseWriter, details ErrorDetails)
429 Too Many Requests
func SendURITooLong ¶
func SendURITooLong(rw http.ResponseWriter, details ErrorDetails)
414 URI Too Long
func SendUnauthorized ¶
func SendUnauthorized(rw http.ResponseWriter, details ErrorDetails)
401 Unauthorized
func SendUnprocessableEntity ¶
func SendUnprocessableEntity(rw http.ResponseWriter, details ErrorDetails)
422 Unprocessable Entity
func SendUnsupportedMediaType ¶
func SendUnsupportedMediaType(rw http.ResponseWriter, details ErrorDetails)
415 Unsupported Media Type
func SendValidationError ¶ added in v1.3.0
func SendValidationError(rw http.ResponseWriter, details ErrorDetails)
func ValidatingHandler ¶ added in v1.2.0
func ValidatingHandler[T any](handler func(http.ResponseWriter, *http.Request, *T)) func(w http.ResponseWriter, r *http.Request)
Types ¶
type ErrorDetails ¶ added in v1.3.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.