Documentation ¶
Overview ¶
Package recv defines a pure computations to compose HTTP response receivers
Index ¶
- Constants
- func Bytes(val *[]byte) http.Arrow
- func Code(code ...http.StatusCode) http.Arrow
- func Recv[T any](out *T) http.Arrow
- type Content
- func (h Content) Any(cat *http.Context) error
- func (h Content) ApplicationJSON(cat *http.Context) error
- func (h Content) Form(cat *http.Context) error
- func (h Content) HTML(cat *http.Context) error
- func (h Content) Is(value string) http.Arrow
- func (h Content) JSON(cat *http.Context) error
- func (h Content) Text(cat *http.Context) error
- func (h Content) TextHTML(cat *http.Context) error
- func (h Content) TextPlain(cat *http.Context) error
- func (h Content) To(value *string) http.Arrow
- type Header
- type StatusCode
- func (code StatusCode) Accepted(cat *http.Context) error
- func (code StatusCode) BadGateway(cat *http.Context) error
- func (code StatusCode) BadRequest(cat *http.Context) error
- func (code StatusCode) Conflict(cat *http.Context) error
- func (code StatusCode) Created(cat *http.Context) error
- func (code StatusCode) Forbidden(cat *http.Context) error
- func (code StatusCode) Found(cat *http.Context) error
- func (code StatusCode) GatewayTimeout(cat *http.Context) error
- func (code StatusCode) Gone(cat *http.Context) error
- func (code StatusCode) HTTPVersionNotSupported(cat *http.Context) error
- func (code StatusCode) InternalServerError(cat *http.Context) error
- func (code StatusCode) LengthRequired(cat *http.Context) error
- func (code StatusCode) MethodNotAllowed(cat *http.Context) error
- func (code StatusCode) MovedPermanently(cat *http.Context) error
- func (code StatusCode) MultipleChoices(cat *http.Context) error
- func (code StatusCode) NoContent(cat *http.Context) error
- func (code StatusCode) NonAuthoritativeInfo(cat *http.Context) error
- func (code StatusCode) NotAcceptable(cat *http.Context) error
- func (code StatusCode) NotFound(cat *http.Context) error
- func (code StatusCode) NotImplemented(cat *http.Context) error
- func (code StatusCode) NotModified(cat *http.Context) error
- func (code StatusCode) OK(cat *http.Context) error
- func (code StatusCode) PaymentRequired(cat *http.Context) error
- func (code StatusCode) PreconditionFailed(cat *http.Context) error
- func (code StatusCode) ProxyAuthRequired(cat *http.Context) error
- func (code StatusCode) RequestEntityTooLarge(cat *http.Context) error
- func (code StatusCode) RequestTimeout(cat *http.Context) error
- func (code StatusCode) RequestURITooLong(cat *http.Context) error
- func (code StatusCode) ResetContent(cat *http.Context) error
- func (code StatusCode) SeeOther(cat *http.Context) error
- func (code StatusCode) ServiceUnavailable(cat *http.Context) error
- func (code StatusCode) Unauthorized(cat *http.Context) error
- func (code StatusCode) UnsupportedMediaType(cat *http.Context) error
- func (code StatusCode) UseProxy(cat *http.Context) error
Constants ¶
const ( CacheControl = Header("Cache-Control") Connection = Header("Connection") ContentEncoding = Header("Content-Encoding") ContentLanguage = Header("Content-Language") ContentLength = Header("Content-Length") ContentType = Content("Content-Type") Date = Header("Date") ETag = Header("ETag") Expires = Header("Expires") LastModified = Header("Last-Modified") Link = Header("Link") Location = Header("Location") Server = Header("Server") SetCookie = Header("Set-Cookie") TransferEncoding = Header("Transfer-Encoding") )
List of supported HTTP header constants https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_fields
const Status = StatusCode(0)
Status is collection of constants for HTTP Status Code checks
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Content ¶
type Content Header
Content defines headers for content negotiation
func (Content) ApplicationJSON ¶ added in v1.1.0
ApplicationJSON matches header `???: application/json`
func (Content) Is ¶
Is matches value of HTTP header, Use wildcard string ("*") to match any header value
type Header ¶
type Header string
Header matches presence of header in the response or match its entire content. The execution fails with BadMatchHead if the matched value do not meet expectations.
http.Join( ... ƒ.ContentType.JSON, ƒ.ContentEncoding.Is(...), )
func (Header) Is ¶
Is matches value of HTTP header, Use wildcard string ("*") to match any header value
type StatusCode ¶
type StatusCode int
StatusCode is a warpper type over http.StatusCode
http.Join( ... ƒ.Code(http.StatusOK), ) so that response code is matched using constant http.Join( ... ƒ.Status.OK, )
func (StatusCode) Accepted ¶
func (code StatusCode) Accepted(cat *http.Context) error
Accepted ⟼ http.StatusAccepted
func (StatusCode) BadGateway ¶
func (code StatusCode) BadGateway(cat *http.Context) error
BadGateway ⟼ http.StatusBadGateway
func (StatusCode) BadRequest ¶
func (code StatusCode) BadRequest(cat *http.Context) error
BadRequest ⟼ http.StatusBadRequest
func (StatusCode) Conflict ¶
func (code StatusCode) Conflict(cat *http.Context) error
Conflict ⟼ http.StatusConflict
func (StatusCode) Created ¶
func (code StatusCode) Created(cat *http.Context) error
Created ⟼ http.StatusCreated
func (StatusCode) Forbidden ¶
func (code StatusCode) Forbidden(cat *http.Context) error
Forbidden ⟼ http.StatusForbidden
func (StatusCode) Found ¶
func (code StatusCode) Found(cat *http.Context) error
Found ⟼ http.StatusFound
func (StatusCode) GatewayTimeout ¶
func (code StatusCode) GatewayTimeout(cat *http.Context) error
GatewayTimeout ⟼ http.StatusGatewayTimeout
func (StatusCode) Gone ¶
func (code StatusCode) Gone(cat *http.Context) error
Gone ⟼ http.StatusGone
func (StatusCode) HTTPVersionNotSupported ¶
func (code StatusCode) HTTPVersionNotSupported(cat *http.Context) error
HTTPVersionNotSupported ⟼ http.StatusHTTPVersionNotSupported
func (StatusCode) InternalServerError ¶
func (code StatusCode) InternalServerError(cat *http.Context) error
InternalServerError ⟼ http.StatusInternalServerError
func (StatusCode) LengthRequired ¶
func (code StatusCode) LengthRequired(cat *http.Context) error
LengthRequired ⟼ http.StatusLengthRequired
func (StatusCode) MethodNotAllowed ¶
func (code StatusCode) MethodNotAllowed(cat *http.Context) error
MethodNotAllowed ⟼ http.StatusMethodNotAllowed
func (StatusCode) MovedPermanently ¶
func (code StatusCode) MovedPermanently(cat *http.Context) error
MovedPermanently ⟼ http.StatusMovedPermanently
func (StatusCode) MultipleChoices ¶
func (code StatusCode) MultipleChoices(cat *http.Context) error
MultipleChoices ⟼ http.StatusMultipleChoices
func (StatusCode) NoContent ¶
func (code StatusCode) NoContent(cat *http.Context) error
NoContent ⟼ http.StatusNoContent
func (StatusCode) NonAuthoritativeInfo ¶
func (code StatusCode) NonAuthoritativeInfo(cat *http.Context) error
NonAuthoritativeInfo ⟼ http.StatusNonAuthoritativeInfo
func (StatusCode) NotAcceptable ¶
func (code StatusCode) NotAcceptable(cat *http.Context) error
NotAcceptable ⟼ http.StatusNotAcceptable
func (StatusCode) NotFound ¶
func (code StatusCode) NotFound(cat *http.Context) error
NotFound ⟼ http.StatusNotFound
func (StatusCode) NotImplemented ¶
func (code StatusCode) NotImplemented(cat *http.Context) error
NotImplemented ⟼ http.StatusNotImplemented
func (StatusCode) NotModified ¶
func (code StatusCode) NotModified(cat *http.Context) error
NotModified ⟼ http.StatusNotModified
func (StatusCode) PaymentRequired ¶
func (code StatusCode) PaymentRequired(cat *http.Context) error
PaymentRequired ⟼ http.StatusPaymentRequired
func (StatusCode) PreconditionFailed ¶
func (code StatusCode) PreconditionFailed(cat *http.Context) error
PreconditionFailed ⟼ http.StatusPreconditionFailed
func (StatusCode) ProxyAuthRequired ¶
func (code StatusCode) ProxyAuthRequired(cat *http.Context) error
ProxyAuthRequired ⟼ http.StatusProxyAuthRequired
func (StatusCode) RequestEntityTooLarge ¶
func (code StatusCode) RequestEntityTooLarge(cat *http.Context) error
RequestEntityTooLarge ⟼ http.StatusRequestEntityTooLarge
func (StatusCode) RequestTimeout ¶
func (code StatusCode) RequestTimeout(cat *http.Context) error
RequestTimeout ⟼ http.StatusRequestTimeout
func (StatusCode) RequestURITooLong ¶
func (code StatusCode) RequestURITooLong(cat *http.Context) error
RequestURITooLong ⟼ http.StatusRequestURITooLong
func (StatusCode) ResetContent ¶
func (code StatusCode) ResetContent(cat *http.Context) error
ResetContent ⟼ http.StatusResetContent
func (StatusCode) SeeOther ¶
func (code StatusCode) SeeOther(cat *http.Context) error
SeeOther ⟼ http.StatusSeeOther
func (StatusCode) ServiceUnavailable ¶
func (code StatusCode) ServiceUnavailable(cat *http.Context) error
ServiceUnavailable ⟼ http.StatusServiceUnavailable
func (StatusCode) Unauthorized ¶
func (code StatusCode) Unauthorized(cat *http.Context) error
Unauthorized ⟼ http.StatusUnauthorized
func (StatusCode) UnsupportedMediaType ¶
func (code StatusCode) UnsupportedMediaType(cat *http.Context) error
UnsupportedMediaType ⟼ http.StatusUnsupportedMediaType