Documentation ¶
Index ¶
- Variables
- func Accepted(w http.ResponseWriter, response interface{})
- func BadGateway(w http.ResponseWriter, response interface{})
- func BadRequest(w http.ResponseWriter, response interface{})
- func Conflict(w http.ResponseWriter, response interface{})
- func Continue(w http.ResponseWriter, response interface{})
- func Created(w http.ResponseWriter, response interface{})
- func ExpectationFailed(w http.ResponseWriter, response interface{})
- func Forbidden(w http.ResponseWriter, response interface{})
- func Found(w http.ResponseWriter, response interface{})
- func GatewayTimeout(w http.ResponseWriter, response interface{})
- func Gone(w http.ResponseWriter, response interface{})
- func HTTPVersionNotSupported(w http.ResponseWriter, response interface{})
- func InternalServerError(w http.ResponseWriter, response interface{})
- func LengthRequired(w http.ResponseWriter, response interface{})
- func MethodNotAllowed(w http.ResponseWriter, response interface{})
- func MovedPermanently(w http.ResponseWriter, response interface{})
- func MultipleChoices(w http.ResponseWriter, response interface{})
- func NonAuthoritativeInfo(w http.ResponseWriter, response interface{})
- func NotAcceptable(w http.ResponseWriter, response interface{})
- func NotFound(w http.ResponseWriter, response interface{})
- func NotFoundHandler(w http.ResponseWriter, _ *http.Request)
- func NotImplemented(w http.ResponseWriter, response interface{})
- func NotModified(w http.ResponseWriter, response interface{})
- func OK(w http.ResponseWriter, response interface{})
- func PartialContent(w http.ResponseWriter, response interface{})
- func PaymentRequired(w http.ResponseWriter, response interface{})
- func PermanentRedirect(w http.ResponseWriter, response interface{})
- func PreconditionFailed(w http.ResponseWriter, response interface{})
- func PreconditionRequired(w http.ResponseWriter, response interface{})
- func ProxyAuthRequired(w http.ResponseWriter, response interface{})
- func RequestEntityTooLarge(w http.ResponseWriter, response interface{})
- func RequestHeaderFieldsTooLarge(w http.ResponseWriter, response interface{})
- func RequestTimeout(w http.ResponseWriter, response interface{})
- func RequestURITooLong(w http.ResponseWriter, response interface{})
- func RequestedRangeNotSatisfiable(w http.ResponseWriter, response interface{})
- func ResetContent(w http.ResponseWriter, response interface{})
- func Respond(w http.ResponseWriter, statusCode int, response interface{})
- func SeeOther(w http.ResponseWriter, response interface{})
- func ServiceUnavailable(w http.ResponseWriter, response interface{})
- func SwitchingProtocols(w http.ResponseWriter, response interface{})
- func Teapot(w http.ResponseWriter, response interface{})
- func TemporaryRedirect(w http.ResponseWriter, response interface{})
- func TooManyRequests(w http.ResponseWriter, response interface{})
- func Unauthorized(w http.ResponseWriter, response interface{})
- func UnavailableForLegalReasons(w http.ResponseWriter, response interface{})
- func UnsupportedMediaType(w http.ResponseWriter, response interface{})
- func UpgradeRequired(w http.ResponseWriter, response interface{})
- func UseProxy(w http.ResponseWriter, response interface{})
- type MethodHandler
- type StatusResponse
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultContentTypeHeader is the value of if "Content-Type" header // in HTTP response. DefaultContentTypeHeader = "application/json; charset=utf-8" // EscapeHTML specifies whether problematic HTML characters // should be escaped inside JSON quoted strings. EscapeHTML = false )
Functions ¶
func Accepted ¶
func Accepted(w http.ResponseWriter, response interface{})
Accepted writes a response with status code 202.
func BadGateway ¶
func BadGateway(w http.ResponseWriter, response interface{})
BadGateway writes a response with status code 502.
func BadRequest ¶
func BadRequest(w http.ResponseWriter, response interface{})
BadRequest writes a response with status code 400.
func Conflict ¶
func Conflict(w http.ResponseWriter, response interface{})
Conflict writes a response with status code 409.
func Continue ¶
func Continue(w http.ResponseWriter, response interface{})
Continue writes a response with status code 100.
func Created ¶
func Created(w http.ResponseWriter, response interface{})
Created writes a response with status code 201.
func ExpectationFailed ¶
func ExpectationFailed(w http.ResponseWriter, response interface{})
ExpectationFailed writes a response with status code 417.
func Forbidden ¶
func Forbidden(w http.ResponseWriter, response interface{})
Forbidden writes a response with status code 403.
func Found ¶
func Found(w http.ResponseWriter, response interface{})
Found writes a response with status code 302.
func GatewayTimeout ¶
func GatewayTimeout(w http.ResponseWriter, response interface{})
GatewayTimeout writes a response with status code 504.
func Gone ¶
func Gone(w http.ResponseWriter, response interface{})
Gone writes a response with status code 410.
func HTTPVersionNotSupported ¶
func HTTPVersionNotSupported(w http.ResponseWriter, response interface{})
HTTPVersionNotSupported writes a response with status code 505.
func InternalServerError ¶
func InternalServerError(w http.ResponseWriter, response interface{})
InternalServerError writes a response with status code 500.
func LengthRequired ¶
func LengthRequired(w http.ResponseWriter, response interface{})
LengthRequired writes a response with status code 411.
func MethodNotAllowed ¶
func MethodNotAllowed(w http.ResponseWriter, response interface{})
MethodNotAllowed writes a response with status code 405.
func MovedPermanently ¶
func MovedPermanently(w http.ResponseWriter, response interface{})
MovedPermanently writes a response with status code 301.
func MultipleChoices ¶
func MultipleChoices(w http.ResponseWriter, response interface{})
MultipleChoices writes a response with status code 300.
func NonAuthoritativeInfo ¶
func NonAuthoritativeInfo(w http.ResponseWriter, response interface{})
NonAuthoritativeInfo writes a response with status code 203.
func NotAcceptable ¶
func NotAcceptable(w http.ResponseWriter, response interface{})
NotAcceptable writes a response with status code 406.
func NotFound ¶
func NotFound(w http.ResponseWriter, response interface{})
NotFound writes a response with status code 404.
func NotFoundHandler ¶
func NotFoundHandler(w http.ResponseWriter, _ *http.Request)
func NotImplemented ¶
func NotImplemented(w http.ResponseWriter, response interface{})
NotImplemented writes a response with status code 501.
func NotModified ¶
func NotModified(w http.ResponseWriter, response interface{})
NotModified writes a response with status code 304.
func OK ¶
func OK(w http.ResponseWriter, response interface{})
OK writes a response with status code 200.
func PartialContent ¶
func PartialContent(w http.ResponseWriter, response interface{})
PartialContent writes a response with status code 206.
func PaymentRequired ¶
func PaymentRequired(w http.ResponseWriter, response interface{})
PaymentRequired writes a response with status code 402.
func PermanentRedirect ¶
func PermanentRedirect(w http.ResponseWriter, response interface{})
PermanentRedirect writes a response with status code 308.
func PreconditionFailed ¶
func PreconditionFailed(w http.ResponseWriter, response interface{})
PreconditionFailed writes a response with status code 412.
func PreconditionRequired ¶
func PreconditionRequired(w http.ResponseWriter, response interface{})
PreconditionRequired writes a response with status code 428.
func ProxyAuthRequired ¶
func ProxyAuthRequired(w http.ResponseWriter, response interface{})
ProxyAuthRequired writes a response with status code 407.
func RequestEntityTooLarge ¶
func RequestEntityTooLarge(w http.ResponseWriter, response interface{})
RequestEntityTooLarge writes a response with status code 413.
func RequestHeaderFieldsTooLarge ¶
func RequestHeaderFieldsTooLarge(w http.ResponseWriter, response interface{})
RequestHeaderFieldsTooLarge writes a response with status code 431.
func RequestTimeout ¶
func RequestTimeout(w http.ResponseWriter, response interface{})
RequestTimeout writes a response with status code 408.
func RequestURITooLong ¶
func RequestURITooLong(w http.ResponseWriter, response interface{})
RequestURITooLong writes a response with status code 414.
func RequestedRangeNotSatisfiable ¶
func RequestedRangeNotSatisfiable(w http.ResponseWriter, response interface{})
RequestedRangeNotSatisfiable writes a response with status code 416.
func ResetContent ¶
func ResetContent(w http.ResponseWriter, response interface{})
ResetContent writes a response with status code 205.
func Respond ¶
func Respond(w http.ResponseWriter, statusCode int, response interface{})
Respond writes a JSON-encoded body to http.ResponseWriter.
func SeeOther ¶
func SeeOther(w http.ResponseWriter, response interface{})
SeeOther writes a response with status code 303.
func ServiceUnavailable ¶
func ServiceUnavailable(w http.ResponseWriter, response interface{})
ServiceUnavailable writes a response with status code 503.
func SwitchingProtocols ¶
func SwitchingProtocols(w http.ResponseWriter, response interface{})
SwitchingProtocols writes a response with status code 101.
func Teapot ¶
func Teapot(w http.ResponseWriter, response interface{})
Teapot writes a response with status code 418.
func TemporaryRedirect ¶
func TemporaryRedirect(w http.ResponseWriter, response interface{})
TemporaryRedirect writes a response with status code 307.
func TooManyRequests ¶
func TooManyRequests(w http.ResponseWriter, response interface{})
TooManyRequests writes a response with status code 429.
func Unauthorized ¶
func Unauthorized(w http.ResponseWriter, response interface{})
Unauthorized writes a response with status code 401.
func UnavailableForLegalReasons ¶
func UnavailableForLegalReasons(w http.ResponseWriter, response interface{})
UnavailableForLegalReasons writes a response with status code 451.
func UnsupportedMediaType ¶
func UnsupportedMediaType(w http.ResponseWriter, response interface{})
UnsupportedMediaType writes a response with status code 415.
func UpgradeRequired ¶
func UpgradeRequired(w http.ResponseWriter, response interface{})
UpgradeRequired writes a response with status code 426.
func UseProxy ¶
func UseProxy(w http.ResponseWriter, response interface{})
UseProxy writes a response with status code 305.
Types ¶
type MethodHandler ¶
func (MethodHandler) ServeHTTP ¶
func (h MethodHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type StatusResponse ¶
type StatusResponse struct { Message string `json:"message,omitempty"` Code int `json:"code,omitempty"` }
StatusResponse is a standardized error format for specific HTTP responses. Code field corresponds with HTTP status code, and Message field is a short description of that code or provides more context about the reason for such response.
If response is string, error or Stringer type the string will be set as value to the Message field.