Safe Haskell | None |
---|---|
Language | Haskell2010 |
The Client module is the primary module you will need to import to perform HTTP requests with this library.
For a comprehensive documentation, please see: https://dormouse.io/client.html
Synopsis
- data HttpRequest url method body contentTag acceptTag = HttpRequest {
- requestMethod :: !(HttpMethod method)
- requestUrl :: !url
- requestHeaders :: Map HeaderName ByteString
- requestBody :: body
- data HttpResponse body = HttpResponse {
- responseStatusCode :: !Int
- responseHeaders :: Map HeaderName ByteString
- responseBody :: body
- delete :: IsUrl url => url -> HttpRequest url "DELETE" Empty EmptyPayload acceptTag
- get :: IsUrl url => url -> HttpRequest url "GET" Empty EmptyPayload acceptTag
- head :: IsUrl url => url -> HttpRequest url "HEAD" Empty EmptyPayload acceptTag
- patch :: IsUrl url => url -> HttpRequest url "PATCH" Empty EmptyPayload acceptTag
- post :: IsUrl url => url -> HttpRequest url "POST" Empty EmptyPayload acceptTag
- put :: IsUrl url => url -> HttpRequest url "PUT" Empty EmptyPayload acceptTag
- supplyBody :: (AllowedBody method b, RequestPayload b contentTag) => Proxy contentTag -> b -> HttpRequest url method b' contentTag' acceptTag -> HttpRequest url method b contentTag acceptTag
- accept :: HasMediaType acceptTag => Proxy acceptTag -> HttpRequest url method b contentTag acceptTag -> HttpRequest url method b contentTag acceptTag
- expectAs :: (MonadDormouseClient m, RequestPayload b contentTag, ResponsePayload b' acceptTag, IsUrl url) => Proxy acceptTag -> HttpRequest url method b contentTag acceptTag -> m (HttpResponse b')
- expect :: (MonadDormouseClient m, RequestPayload b contentTag, ResponsePayload b' acceptTag, IsUrl url) => HttpRequest url method b contentTag acceptTag -> m (HttpResponse b')
- data DormouseClientT m a
- type DormouseClient a = DormouseClientT IO a
- runDormouseClientT :: DormouseClientConfig -> DormouseClientT m a -> m a
- runDormouseClient :: DormouseClientConfig -> DormouseClient a -> IO a
- class Monad m => MonadDormouseClient m where
- send :: IsUrl url => HttpRequest url method RawRequestPayload contentTag acceptTag -> (HttpResponse (SerialT IO Word8) -> IO (HttpResponse b)) -> m (HttpResponse b)
- newManager :: ManagerSettings -> IO Manager
- tlsManagerSettings :: ManagerSettings
- class HasDormouseClientConfig a where
- newtype DormouseClientConfig = DormouseClientConfig {}
- type HeaderName = CI ByteString
- class HasHeaders a where
- getHeaders :: a -> Map HeaderName ByteString
- getHeaderValue :: HeaderName -> a -> Maybe ByteString
- class HasMediaType tag where
- data HttpMethod (a :: Symbol) where
- CONNECT :: HttpMethod "CONNECT"
- DELETE :: HttpMethod "DELETE"
- HEAD :: HttpMethod "HEAD"
- GET :: HttpMethod "GET"
- OPTIONS :: HttpMethod "OPTIONS"
- PATCH :: HttpMethod "PATCH"
- POST :: HttpMethod "POST"
- PUT :: HttpMethod "PUT"
- TRACE :: HttpMethod "TRACE"
- CUSTOM :: KnownSymbol a => Proxy a -> HttpMethod a
- type family AllowedBody (a :: Symbol) b :: Constraint
- methodAsByteString :: HttpMethod a -> ByteString
- data RawRequestPayload
- class HasMediaType contentTag => RequestPayload body contentTag where
- serialiseRequest :: Proxy contentTag -> HttpRequest url method body contentTag acceptTag -> HttpRequest url method RawRequestPayload contentTag acceptTag
- class HasMediaType tag => ResponsePayload body tag where
- deserialiseRequest :: Proxy tag -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse body)
- data EmptyPayload
- data HtmlPayload
- data JsonPayload
- data UrlFormPayload
- data Empty
- json :: Proxy JsonPayload
- urlForm :: Proxy UrlFormPayload
- noPayload :: Proxy EmptyPayload
- html :: Proxy HtmlPayload
- data SomeDormouseException = forall e.Exception e => SomeDormouseException e
- newtype DecodingException = DecodingException {}
- newtype MediaTypeException = MediaTypeException {}
- newtype UnexpectedStatusCodeException = UnexpectedStatusCodeException {
- uscStatusCode :: Int
- newtype UriException = UriException {}
- newtype UrlException = UrlException {}
- data Uri
- parseUri :: MonadThrow m => ByteString -> m Uri
- data Url (scheme :: Symbol)
- data AnyUrl = AnyUrl (Url scheme)
- class (Eq url, Show url) => IsUrl url where
- ensureHttp :: MonadThrow m => AnyUrl -> m (Url "http")
- ensureHttps :: MonadThrow m => AnyUrl -> m (Url "https")
- parseUrl :: MonadThrow m => ByteString -> m AnyUrl
- parseHttpUrl :: MonadThrow m => ByteString -> m (Url "http")
- parseHttpsUrl :: MonadThrow m => ByteString -> m (Url "https")
Request / Response Types
data HttpRequest url method body contentTag acceptTag Source #
Model of an HTTP request with type parameters: scheme
describing the uri scheme, body
describing the type of the content body, contentTag
describing the type, method
describing the HTTP verb associated with the request, contentTag
describing the type of content being sen and acceptTag
describing the type of content desired
HttpRequest | |
|
Instances
(Eq body, Eq url) => Eq (HttpRequest url method body contentTag acceptTag) Source # | |
Defined in Dormouse.Client.Types (==) :: HttpRequest url method body contentTag acceptTag -> HttpRequest url method body contentTag acceptTag -> Bool # (/=) :: HttpRequest url method body contentTag acceptTag -> HttpRequest url method body contentTag acceptTag -> Bool # | |
(Show body, Show url) => Show (HttpRequest url method body contentTag acceptTag) Source # | |
Defined in Dormouse.Client.Types showsPrec :: Int -> HttpRequest url method body contentTag acceptTag -> ShowS # show :: HttpRequest url method body contentTag acceptTag -> String # showList :: [HttpRequest url method body contentTag acceptTag] -> ShowS # | |
HasHeaders (HttpRequest url method body contentTag acceptTag) Source # | |
Defined in Dormouse.Client.Types getHeaders :: HttpRequest url method body contentTag acceptTag -> Map HeaderName ByteString Source # getHeaderValue :: HeaderName -> HttpRequest url method body contentTag acceptTag -> Maybe ByteString Source # |
data HttpResponse body Source #
Model of an HTTP response with the type parameter body
describing the type of the content body.
HttpResponse | |
|
Instances
Eq body => Eq (HttpResponse body) Source # | |
Defined in Dormouse.Client.Types (==) :: HttpResponse body -> HttpResponse body -> Bool # (/=) :: HttpResponse body -> HttpResponse body -> Bool # | |
Show body => Show (HttpResponse body) Source # | |
Defined in Dormouse.Client.Types showsPrec :: Int -> HttpResponse body -> ShowS # show :: HttpResponse body -> String # showList :: [HttpResponse body] -> ShowS # | |
HasHeaders (HttpResponse b) Source # | |
Defined in Dormouse.Client.Types getHeaders :: HttpResponse b -> Map HeaderName ByteString Source # getHeaderValue :: HeaderName -> HttpResponse b -> Maybe ByteString Source # |
Request building
delete :: IsUrl url => url -> HttpRequest url "DELETE" Empty EmptyPayload acceptTag Source #
Create an HTTP DELETE request with the supplied URI, containing no body and no headers
get :: IsUrl url => url -> HttpRequest url "GET" Empty EmptyPayload acceptTag Source #
Create an HTTP GET request with the supplied URI, containing no body and no headers
head :: IsUrl url => url -> HttpRequest url "HEAD" Empty EmptyPayload acceptTag Source #
Create an HTTP HEAD request with the supplied URI, containing no body and no headers
patch :: IsUrl url => url -> HttpRequest url "PATCH" Empty EmptyPayload acceptTag Source #
Create an HTTP PATCH request with the supplied URI, containing no body and no headers
post :: IsUrl url => url -> HttpRequest url "POST" Empty EmptyPayload acceptTag Source #
Create an HTTP POST request with the supplied URI, containing no body and no headers
put :: IsUrl url => url -> HttpRequest url "PUT" Empty EmptyPayload acceptTag Source #
Create an HTTP PUT request with the supplied URI, containing no body and no headers
supplyBody :: (AllowedBody method b, RequestPayload b contentTag) => Proxy contentTag -> b -> HttpRequest url method b' contentTag' acceptTag -> HttpRequest url method b contentTag acceptTag Source #
Supply a body to an HTTP request using the supplied tag to indicate how the request should be encoded
accept :: HasMediaType acceptTag => Proxy acceptTag -> HttpRequest url method b contentTag acceptTag -> HttpRequest url method b contentTag acceptTag Source #
Apply an accept header derived from the supplied tag proxy and add a type hint to the request, indicating how the response should be decodable
expectAs :: (MonadDormouseClient m, RequestPayload b contentTag, ResponsePayload b' acceptTag, IsUrl url) => Proxy acceptTag -> HttpRequest url method b contentTag acceptTag -> m (HttpResponse b') Source #
Make the supplied HTTP request, expecting an HTTP response in the supplied format with body type b
to be delivered in some 'MonadDormouseClient m'
expect :: (MonadDormouseClient m, RequestPayload b contentTag, ResponsePayload b' acceptTag, IsUrl url) => HttpRequest url method b contentTag acceptTag -> m (HttpResponse b') Source #
Make the supplied HTTP request, expecting an HTTP response with body type b
to be delivered in some 'MonadDormouseClient m'
Dormouse Client Monad and Transformer
data DormouseClientT m a Source #
The DormouseClientT Monad Transformer
Instances
type DormouseClient a = DormouseClientT IO a Source #
A simple monad that allows you to run DormouseClient
runDormouseClientT :: DormouseClientConfig -> DormouseClientT m a -> m a Source #
Run a DormouseClientT
using the supplied DormouseClientConfig
to generate a result in the underlying monad m
runDormouseClient :: DormouseClientConfig -> DormouseClient a -> IO a Source #
Run a DormouseClient
using the supplied DormouseClientConfig
to generate a result in IO
Dormouse Client Class
class Monad m => MonadDormouseClient m where Source #
MonadDormouseClient describes the capability to send HTTP requests and receive an HTTP response
send :: IsUrl url => HttpRequest url method RawRequestPayload contentTag acceptTag -> (HttpResponse (SerialT IO Word8) -> IO (HttpResponse b)) -> m (HttpResponse b) Source #
Sends a supplied HTTP request and retrieves a response within the supplied monad m
Instances
(Monad m, MonadIO m, MonadDormouseTestClient m) => MonadDormouseClient m Source # | |
Defined in Dormouse.Client.Test.Class send :: forall url (method :: Symbol) contentTag acceptTag b. IsUrl url => HttpRequest url method RawRequestPayload contentTag acceptTag -> (HttpResponse (SerialT IO Word8) -> IO (HttpResponse b)) -> m (HttpResponse b) Source # | |
(MonadIO m, MonadThrow m) => MonadDormouseClient (DormouseClientT m) Source # | |
Defined in Dormouse.Client send :: forall url (method :: Symbol) contentTag acceptTag b. IsUrl url => HttpRequest url method RawRequestPayload contentTag acceptTag -> (HttpResponse (SerialT IO Word8) -> IO (HttpResponse b)) -> DormouseClientT m (HttpResponse b) Source # |
Dormouse Client Config
newManager :: ManagerSettings -> IO Manager #
Create a Manager
. The Manager
will be shut down automatically via
garbage collection.
Creating a new Manager
is a relatively expensive operation, you are
advised to share a single Manager
between requests instead.
The first argument to this function is often defaultManagerSettings
,
though add-on libraries may provide a recommended replacement.
Since 0.1.0
tlsManagerSettings :: ManagerSettings #
Default TLS-enabled manager settings
class HasDormouseClientConfig a where Source #
Describes the capability to retrieve a Dormouse Config
Instances
newtype DormouseClientConfig Source #
The configuration options required to run Dormouse
Instances
HasDormouseClientConfig DormouseClientConfig Source # | |
Monad m => MonadReader DormouseClientConfig (DormouseClientT m) Source # | |
Defined in Dormouse.Client ask :: DormouseClientT m DormouseClientConfig # local :: (DormouseClientConfig -> DormouseClientConfig) -> DormouseClientT m a -> DormouseClientT m a # reader :: (DormouseClientConfig -> a) -> DormouseClientT m a # |
Headers
type HeaderName = CI ByteString Source #
The name of an HTTP Header. Header names are case insensitive.
class HasHeaders a where Source #
Describes something which has headers
getHeaders :: a -> Map HeaderName ByteString Source #
Retrieve all of the headers which a
has.
getHeaderValue :: HeaderName -> a -> Maybe ByteString Source #
Try to retrieve a specific header from a
with the supplied HeaderName
Instances
HasHeaders (HttpResponse b) Source # | |
Defined in Dormouse.Client.Types getHeaders :: HttpResponse b -> Map HeaderName ByteString Source # getHeaderValue :: HeaderName -> HttpResponse b -> Maybe ByteString Source # | |
HasHeaders (HttpRequest url method body contentTag acceptTag) Source # | |
Defined in Dormouse.Client.Types getHeaders :: HttpRequest url method body contentTag acceptTag -> Map HeaderName ByteString Source # getHeaderValue :: HeaderName -> HttpRequest url method body contentTag acceptTag -> Maybe ByteString Source # |
class HasMediaType tag where Source #
Describes an association between a type tag
and a specific Media Type
Instances
HasMediaType HtmlPayload Source # | |
Defined in Dormouse.Client.Payload | |
HasMediaType EmptyPayload Source # | |
Defined in Dormouse.Client.Payload | |
HasMediaType UrlFormPayload Source # | |
Defined in Dormouse.Client.Payload | |
HasMediaType JsonPayload Source # | |
Defined in Dormouse.Client.Payload |
Methods
data HttpMethod (a :: Symbol) where Source #
CONNECT :: HttpMethod "CONNECT" | |
DELETE :: HttpMethod "DELETE" | |
HEAD :: HttpMethod "HEAD" | |
GET :: HttpMethod "GET" | |
OPTIONS :: HttpMethod "OPTIONS" | |
PATCH :: HttpMethod "PATCH" | |
POST :: HttpMethod "POST" | |
PUT :: HttpMethod "PUT" | |
TRACE :: HttpMethod "TRACE" | |
CUSTOM :: KnownSymbol a => Proxy a -> HttpMethod a |
Instances
Eq (HttpMethod a) Source # | |
Defined in Dormouse.Client.Methods (==) :: HttpMethod a -> HttpMethod a -> Bool # (/=) :: HttpMethod a -> HttpMethod a -> Bool # | |
Show (HttpMethod a) Source # | |
Defined in Dormouse.Client.Methods showsPrec :: Int -> HttpMethod a -> ShowS # show :: HttpMethod a -> String # showList :: [HttpMethod a] -> ShowS # |
type family AllowedBody (a :: Symbol) b :: Constraint Source #
Instances
type AllowedBody "CONNECT" b Source # | |
Defined in Dormouse.Client.Methods | |
type AllowedBody "DELETE" b Source # | |
Defined in Dormouse.Client.Methods type AllowedBody "DELETE" b = () | |
type AllowedBody "GET" b Source # | |
Defined in Dormouse.Client.Methods | |
type AllowedBody "HEAD" b Source # | |
Defined in Dormouse.Client.Methods | |
type AllowedBody "OPTIONS" b Source # | |
Defined in Dormouse.Client.Methods | |
type AllowedBody "PATCH" b Source # | |
Defined in Dormouse.Client.Methods type AllowedBody "PATCH" b = () | |
type AllowedBody "POST" b Source # | |
Defined in Dormouse.Client.Methods type AllowedBody "POST" b = () | |
type AllowedBody "PUT" b Source # | |
Defined in Dormouse.Client.Methods type AllowedBody "PUT" b = () | |
type AllowedBody "TRACE" b Source # | |
Defined in Dormouse.Client.Methods |
methodAsByteString :: HttpMethod a -> ByteString Source #
Payloads
data RawRequestPayload Source #
A raw HTTP Request payload consisting of a stream of bytes with either a defined Content Length or using Chunked Transfer Encoding
DefinedContentLength Word64 (SerialT IO Word8) | DefinedContentLength represents a payload where the size of the message is known in advance and the content length header can be computed |
ChunkedTransfer (SerialT IO Word8) | ChunkedTransfer represents a payload with indertiminate length, to be sent using chunked transfer encoding |
class HasMediaType contentTag => RequestPayload body contentTag where Source #
RequestPayload relates a type of content and a payload tag used to describe that type to its byte stream representation and the constraints required to encode it
serialiseRequest :: Proxy contentTag -> HttpRequest url method body contentTag acceptTag -> HttpRequest url method RawRequestPayload contentTag acceptTag Source #
Generates a the byte stream representation from the supplied content
Instances
class HasMediaType tag => ResponsePayload body tag where Source #
ResponsePayload relates a type of content and a payload tag used to describe that type to its byte stream representation and the constraints required to decode it
deserialiseRequest :: Proxy tag -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse body) Source #
Decodes the high level representation from the supplied byte stream
Instances
FromForm body => ResponsePayload body UrlFormPayload Source # | |
Defined in Dormouse.Client.Payload deserialiseRequest :: Proxy UrlFormPayload -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse body) Source # | |
FromJSON body => ResponsePayload body JsonPayload Source # | |
Defined in Dormouse.Client.Payload deserialiseRequest :: Proxy JsonPayload -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse body) Source # | |
ResponsePayload Text HtmlPayload Source # | |
Defined in Dormouse.Client.Payload deserialiseRequest :: Proxy HtmlPayload -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse Text) Source # | |
ResponsePayload Empty EmptyPayload Source # | |
Defined in Dormouse.Client.Payload deserialiseRequest :: Proxy EmptyPayload -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse Empty) Source # |
data EmptyPayload Source #
Instances
HasMediaType EmptyPayload Source # | |
Defined in Dormouse.Client.Payload | |
ResponsePayload Empty EmptyPayload Source # | |
Defined in Dormouse.Client.Payload deserialiseRequest :: Proxy EmptyPayload -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse Empty) Source # | |
RequestPayload Empty EmptyPayload Source # | |
Defined in Dormouse.Client.Payload serialiseRequest :: forall url (method :: Symbol) acceptTag. Proxy EmptyPayload -> HttpRequest url method Empty EmptyPayload acceptTag -> HttpRequest url method RawRequestPayload EmptyPayload acceptTag Source # |
data HtmlPayload Source #
Instances
HasMediaType HtmlPayload Source # | |
Defined in Dormouse.Client.Payload | |
ResponsePayload Text HtmlPayload Source # | |
Defined in Dormouse.Client.Payload deserialiseRequest :: Proxy HtmlPayload -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse Text) Source # | |
RequestPayload Text HtmlPayload Source # | |
Defined in Dormouse.Client.Payload serialiseRequest :: forall url (method :: Symbol) acceptTag. Proxy HtmlPayload -> HttpRequest url method Text HtmlPayload acceptTag -> HttpRequest url method RawRequestPayload HtmlPayload acceptTag Source # |
data JsonPayload Source #
Instances
HasMediaType JsonPayload Source # | |
Defined in Dormouse.Client.Payload | |
FromJSON body => ResponsePayload body JsonPayload Source # | |
Defined in Dormouse.Client.Payload deserialiseRequest :: Proxy JsonPayload -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse body) Source # | |
ToJSON body => RequestPayload body JsonPayload Source # | |
Defined in Dormouse.Client.Payload serialiseRequest :: forall url (method :: Symbol) acceptTag. Proxy JsonPayload -> HttpRequest url method body JsonPayload acceptTag -> HttpRequest url method RawRequestPayload JsonPayload acceptTag Source # |
data UrlFormPayload Source #
Instances
HasMediaType UrlFormPayload Source # | |
Defined in Dormouse.Client.Payload | |
FromForm body => ResponsePayload body UrlFormPayload Source # | |
Defined in Dormouse.Client.Payload deserialiseRequest :: Proxy UrlFormPayload -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse body) Source # | |
ToForm body => RequestPayload body UrlFormPayload Source # | |
Defined in Dormouse.Client.Payload serialiseRequest :: forall url (method :: Symbol) acceptTag. Proxy UrlFormPayload -> HttpRequest url method body UrlFormPayload acceptTag -> HttpRequest url method RawRequestPayload UrlFormPayload acceptTag Source # |
Instances
ResponsePayload Empty EmptyPayload Source # | |
Defined in Dormouse.Client.Payload deserialiseRequest :: Proxy EmptyPayload -> HttpResponse (SerialT IO Word8) -> IO (HttpResponse Empty) Source # | |
RequestPayload Empty EmptyPayload Source # | |
Defined in Dormouse.Client.Payload serialiseRequest :: forall url (method :: Symbol) acceptTag. Proxy EmptyPayload -> HttpRequest url method Empty EmptyPayload acceptTag -> HttpRequest url method RawRequestPayload EmptyPayload acceptTag Source # |
json :: Proxy JsonPayload Source #
A type tag used to indicate that a request/response should be encoded/decoded as application/json
data
urlForm :: Proxy UrlFormPayload Source #
A type tag used to indicate that a request/response should be encoded/decoded as application/x-www-form-urlencoded
data
noPayload :: Proxy EmptyPayload Source #
A type tag used to indicate that a request/response has no payload
html :: Proxy HtmlPayload Source #
A type tag used to indicate that a request/response should be encoded/decoded as text/html
data
Exceptions
data SomeDormouseException Source #
forall e.Exception e => SomeDormouseException e |
Instances
Show SomeDormouseException Source # | |
Defined in Dormouse.Client.Exception showsPrec :: Int -> SomeDormouseException -> ShowS # show :: SomeDormouseException -> String # showList :: [SomeDormouseException] -> ShowS # | |
Exception SomeDormouseException Source # | |
newtype DecodingException Source #
DecodingException
is used to when something has gone wrong decoding an http response into the expected representation, e.g. json was expected but the response json was invalid.
Instances
Show DecodingException Source # | |
Defined in Dormouse.Client.Exception showsPrec :: Int -> DecodingException -> ShowS # show :: DecodingException -> String # showList :: [DecodingException] -> ShowS # | |
Exception DecodingException Source # | |
Defined in Dormouse.Client.Exception |
newtype MediaTypeException Source #
MediaTypeException
is used to indicate an error parsing a MediaType header such as "Content-Type" into a valid MediaType
Instances
Show MediaTypeException Source # | |
Defined in Dormouse.Client.Exception showsPrec :: Int -> MediaTypeException -> ShowS # show :: MediaTypeException -> String # showList :: [MediaTypeException] -> ShowS # | |
Exception MediaTypeException Source # | |
Defined in Dormouse.Client.Exception |
newtype UnexpectedStatusCodeException Source #
UnexpectedStatusCodeException
is used to indicate that the remote server returned an unexpected status code value, for instance an unsuccessful (non-2XX) status code.
Instances
newtype UriException #
UriException
is used to indicate an error parsing a URI
Instances
Show UriException | |
Defined in Dormouse.Uri.Exception showsPrec :: Int -> UriException -> ShowS # show :: UriException -> String # showList :: [UriException] -> ShowS # | |
Exception UriException | |
Defined in Dormouse.Uri.Exception |
newtype UrlException #
UrlException
is used to indicate an error in transforming a valid URI into a URL, e.g. the URI refers to a different schema such as file
Instances
Show UrlException | |
Defined in Dormouse.Url.Exception showsPrec :: Int -> UrlException -> ShowS # show :: UrlException -> String # showList :: [UrlException] -> ShowS # | |
Exception UrlException | |
Defined in Dormouse.Url.Exception |
Uri
A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource. It is defined according to RFC 3986 (https://tools.ietf.org/html/rfc3986). URIs can be absolute (i.e. defined against a specific scheme) or relative.
parseUri :: MonadThrow m => ByteString -> m Uri #
Parse an ascii ByteString
as an absolute uri, throwing a UriException
in m
if this fails
Url
A Url
is defined here as an absolute URI in the http
or https
schemes. Authority components are requried by the http / https
Uri schemes.
ensureHttp :: MonadThrow m => AnyUrl -> m (Url "http") #
Ensure that the supplied Url uses the _http_ scheme, throwing a UrlException
in m
if this is not the case
ensureHttps :: MonadThrow m => AnyUrl -> m (Url "https") #
Ensure that the supplied Url uses the _https_ scheme, throwing a UrlException
in m
if this is not the case
parseUrl :: MonadThrow m => ByteString -> m AnyUrl #
Parse an ascii ByteString
as a url, throwing a UriException
in m
if this fails
parseHttpUrl :: MonadThrow m => ByteString -> m (Url "http") #
Parse an ascii ByteString
as an http url, throwing a UriException
in m
if this fails
parseHttpsUrl :: MonadThrow m => ByteString -> m (Url "https") #
Parse an ascii ByteString
as an https url, throwing a UriException
in m
if this fails