recv

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2021 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package recv defines a pure computations to compose HTTP response receivers

Index

Constants

View Source
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

View Source
const Status = StatusCode(0)

Status is collection of constants for HTTP Status Code checks

Variables

This section is empty.

Functions

func Bytes

func Bytes(val *[]byte) http.Arrow

Bytes receive raw binary from HTTP response

func Code

func Code(code ...http.StatusCode) http.Arrow

Code is a mandatory statement to match expected HTTP Status Code against received one. The execution fails StatusCode error if service responds with other value then specified one.

func Recv

func Recv(out interface{}) http.Arrow

Recv applies auto decoders for response and returns either binary or native Go data structure. The Content-Type header give a hint to decoder. Supply the pointer to data target data structure.

Types

type Content

type Content Header

Content defines headers for content negotiation

func (Content) Any

func (h Content) Any(cat *gurl.IOCat) *gurl.IOCat

Any matches a header value `???: *`

func (Content) Form

func (h Content) Form(cat *gurl.IOCat) *gurl.IOCat

Form matches Header `???: application/x-www-form-urlencoded`

func (Content) HTML

func (h Content) HTML(cat *gurl.IOCat) *gurl.IOCat

HTML matches Header `???: text/html`

func (Content) Is

func (h Content) Is(value string) http.Arrow

Is matches value of HTTP header, Use wildcard string ("*") to match any header value

func (Content) JSON

func (h Content) JSON(cat *gurl.IOCat) *gurl.IOCat

JSON matches header `???: application/json`

func (Content) String

func (h Content) String(value *string) http.Arrow

String matches a header value to closed variable of string type.

func (Content) Text

func (h Content) Text(cat *gurl.IOCat) *gurl.IOCat

Text matches Header `???: text/plain`

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) Any

func (header Header) Any(cat *gurl.IOCat) *gurl.IOCat

Any matches a header value, syntax sugar of Header(...).Is("*")

func (Header) Is

func (header Header) Is(value string) http.Arrow

Is matches value of HTTP header, Use wildcard string ("*") to match any header value

func (Header) Match

func (header Header) Match(cat *gurl.IOCat, value string) *gurl.IOCat

Match is combinator to check HTTP header value

func (Header) String

func (header Header) String(value *string) http.Arrow

String matches a header value to closed variable of string type.

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 *gurl.IOCat) *gurl.IOCat

Accepted ⟼ http.StatusAccepted

func (StatusCode) BadGateway

func (code StatusCode) BadGateway(cat *gurl.IOCat) *gurl.IOCat

BadGateway ⟼ http.StatusBadGateway

func (StatusCode) BadRequest

func (code StatusCode) BadRequest(cat *gurl.IOCat) *gurl.IOCat

BadRequest ⟼ http.StatusBadRequest

func (StatusCode) Conflict

func (code StatusCode) Conflict(cat *gurl.IOCat) *gurl.IOCat

Conflict ⟼ http.StatusConflict

func (StatusCode) Created

func (code StatusCode) Created(cat *gurl.IOCat) *gurl.IOCat

Created ⟼ http.StatusCreated

func (StatusCode) Forbidden

func (code StatusCode) Forbidden(cat *gurl.IOCat) *gurl.IOCat

Forbidden ⟼ http.StatusForbidden

func (StatusCode) Found

func (code StatusCode) Found(cat *gurl.IOCat) *gurl.IOCat

Found ⟼ http.StatusFound

func (StatusCode) GatewayTimeout

func (code StatusCode) GatewayTimeout(cat *gurl.IOCat) *gurl.IOCat

GatewayTimeout ⟼ http.StatusGatewayTimeout

func (StatusCode) Gone

func (code StatusCode) Gone(cat *gurl.IOCat) *gurl.IOCat

Gone ⟼ http.StatusGone

func (StatusCode) HTTPVersionNotSupported

func (code StatusCode) HTTPVersionNotSupported(cat *gurl.IOCat) *gurl.IOCat

HTTPVersionNotSupported ⟼ http.StatusHTTPVersionNotSupported

func (StatusCode) InternalServerError

func (code StatusCode) InternalServerError(cat *gurl.IOCat) *gurl.IOCat

InternalServerError ⟼ http.StatusInternalServerError

func (StatusCode) LengthRequired

func (code StatusCode) LengthRequired(cat *gurl.IOCat) *gurl.IOCat

LengthRequired ⟼ http.StatusLengthRequired

func (StatusCode) MethodNotAllowed

func (code StatusCode) MethodNotAllowed(cat *gurl.IOCat) *gurl.IOCat

MethodNotAllowed ⟼ http.StatusMethodNotAllowed

func (StatusCode) MovedPermanently

func (code StatusCode) MovedPermanently(cat *gurl.IOCat) *gurl.IOCat

MovedPermanently ⟼ http.StatusMovedPermanently

func (StatusCode) MultipleChoices

func (code StatusCode) MultipleChoices(cat *gurl.IOCat) *gurl.IOCat

MultipleChoices ⟼ http.StatusMultipleChoices

func (StatusCode) NoContent

func (code StatusCode) NoContent(cat *gurl.IOCat) *gurl.IOCat

NoContent ⟼ http.StatusNoContent

func (StatusCode) NonAuthoritativeInfo

func (code StatusCode) NonAuthoritativeInfo(cat *gurl.IOCat) *gurl.IOCat

NonAuthoritativeInfo ⟼ http.StatusNonAuthoritativeInfo

func (StatusCode) NotAcceptable

func (code StatusCode) NotAcceptable(cat *gurl.IOCat) *gurl.IOCat

NotAcceptable ⟼ http.StatusNotAcceptable

func (StatusCode) NotFound

func (code StatusCode) NotFound(cat *gurl.IOCat) *gurl.IOCat

NotFound ⟼ http.StatusNotFound

func (StatusCode) NotImplemented

func (code StatusCode) NotImplemented(cat *gurl.IOCat) *gurl.IOCat

NotImplemented ⟼ http.StatusNotImplemented

func (StatusCode) NotModified

func (code StatusCode) NotModified(cat *gurl.IOCat) *gurl.IOCat

NotModified ⟼ http.StatusNotModified

func (StatusCode) OK

func (code StatusCode) OK(cat *gurl.IOCat) *gurl.IOCat

OK ⟼ http.StatusOK

func (StatusCode) PaymentRequired

func (code StatusCode) PaymentRequired(cat *gurl.IOCat) *gurl.IOCat

PaymentRequired ⟼ http.StatusPaymentRequired

func (StatusCode) PreconditionFailed

func (code StatusCode) PreconditionFailed(cat *gurl.IOCat) *gurl.IOCat

PreconditionFailed ⟼ http.StatusPreconditionFailed

func (StatusCode) ProxyAuthRequired

func (code StatusCode) ProxyAuthRequired(cat *gurl.IOCat) *gurl.IOCat

ProxyAuthRequired ⟼ http.StatusProxyAuthRequired

func (StatusCode) RequestEntityTooLarge

func (code StatusCode) RequestEntityTooLarge(cat *gurl.IOCat) *gurl.IOCat

RequestEntityTooLarge ⟼ http.StatusRequestEntityTooLarge

func (StatusCode) RequestTimeout

func (code StatusCode) RequestTimeout(cat *gurl.IOCat) *gurl.IOCat

RequestTimeout ⟼ http.StatusRequestTimeout

func (StatusCode) RequestURITooLong

func (code StatusCode) RequestURITooLong(cat *gurl.IOCat) *gurl.IOCat

RequestURITooLong ⟼ http.StatusRequestURITooLong

func (StatusCode) ResetContent

func (code StatusCode) ResetContent(cat *gurl.IOCat) *gurl.IOCat

ResetContent ⟼ http.StatusResetContent

func (StatusCode) SeeOther

func (code StatusCode) SeeOther(cat *gurl.IOCat) *gurl.IOCat

SeeOther ⟼ http.StatusSeeOther

func (StatusCode) ServiceUnavailable

func (code StatusCode) ServiceUnavailable(cat *gurl.IOCat) *gurl.IOCat

ServiceUnavailable ⟼ http.StatusServiceUnavailable

func (StatusCode) Unauthorized

func (code StatusCode) Unauthorized(cat *gurl.IOCat) *gurl.IOCat

Unauthorized ⟼ http.StatusUnauthorized

func (StatusCode) UnsupportedMediaType

func (code StatusCode) UnsupportedMediaType(cat *gurl.IOCat) *gurl.IOCat

UnsupportedMediaType ⟼ http.StatusUnsupportedMediaType

func (StatusCode) UseProxy

func (code StatusCode) UseProxy(cat *gurl.IOCat) *gurl.IOCat

UseProxy ⟼ http.StatusUseProxy

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL