Documentation
¶
Index ¶
Constants ¶
View Source
const (
HeaderContentType = "Content-Type"
)
Variables ¶
View Source
var ( // ValidateResponse validates an HTTP response and returns an [E.Either] if the response is not a success ValidateResponse = E.FromPredicate(isValidStatus, StatusCodeError) // ValidateJSONResponse checks if an HTTP response is a valid JSON response ValidateJSONResponse = F.Flow2( E.Of[error, *H.Response], E.ChainFirst(F.Flow5( GetHeader, R.Lookup[H.Header](HeaderContentType), O.Chain(A.First[string]), E.FromOption[string](errors.OnNone("unable to access the [%s] header", HeaderContentType)), E.ChainFirst(validateJSONContentTypeString), ))) // ValidateJsonResponse checks if an HTTP response is a valid JSON response // // Deprecated: use [ValidateJSONResponse] instead ValidateJsonResponse = ValidateJSONResponse )
Functions ¶
func ParseMediaType ¶
func ParseMediaType(mediaType string) E.Either[error, ParsedMediaType]
ParseMediaType parses a media type into a tuple
Types ¶
type FullResponse ¶
FullResponse represents a full http response, including headers and body
Click to show internal directories.
Click to hide internal directories.