record HttpClient : Type -> Type- Totality: possibly not terminating due to call to $resolved25483
Visibility: public export
Constructor: MkHttpClient : IORef CookieJar -> Bool -> Bool -> PoolManager e -> HttpClient e
Projections:
.cookie_jar : HttpClient e -> IORef CookieJar .follow_redirect : HttpClient e -> Bool .pool_manager : HttpClient e -> PoolManager e .store_cookie : HttpClient e -> Bool
.cookie_jar : HttpClient e -> IORef CookieJar- Visibility: public export
cookie_jar : HttpClient e -> IORef CookieJar- Visibility: public export
.store_cookie : HttpClient e -> Bool- Visibility: public export
store_cookie : HttpClient e -> Bool- Visibility: public export
.follow_redirect : HttpClient e -> Bool- Visibility: public export
follow_redirect : HttpClient e -> Bool- Visibility: public export
.pool_manager : HttpClient e -> PoolManager e- Visibility: public export
pool_manager : HttpClient e -> PoolManager e- Visibility: public export
close : HasIO io => HttpClient e -> io () Close all existing connections in the HTTP client.
A closed client can be reused again.
Visibility: exportnew_client : HasIO io => (String -> CertificateCheck IO) -> (max_total_connection : Nat) -> {auto 0 _ : NonZero max_total_connection} -> (max_per_site_connection : Nat) -> {auto 0 _ : NonZero max_per_site_connection} -> {auto 0 _ : LTE max_per_site_connection max_total_connection} -> Bool -> Bool -> io (HttpClient e) Creates a new HTTP client.
Arguments:
@ cert_checker the function used to verify the website's TLS certificate.
`certificate_check` and `certificate_ignore_check` are provided in `Network.TLS`.
@ max_total_connection the maximum alive connections (per protocol) allowed
@ max_per_site_connection the maximum alive connections (per protocol) per site allowed
@ store_cookie whether the client should store received cookies
@ follow_redirect whether the client should follow redirects according to response status codes
Visibility: exportnew_client_default : HasIO io => io (HttpClient e) Create a new HTTP client with default configuration.
This would also verify the website's TLS certificate with the system's trusted CAs.
max_total_connection = 25
max_per_site_connection = 5
store_cookie = True
follow_redirect = True
Visibility: exportrequest' : MonadError (HttpError e) m => HasIO m => HttpClient e -> Method -> URL -> List (String, String) -> Nat -> Stream (Of Bits8) (EitherT e IO) () -> m (HttpResponse, Stream (Of Bits8) m ()) Send a HTTP request, returns a `HttpResponse` containing the status code and headers,
and also a stream of the content body from the response.
Arguments:
@ client the HTTP client
@ method the HTTP method, e.g. GET / POST
@ url the URL to of the website to be connected to
@ headers the HTTP headers, represented as a list of (key, value)
@ length the length of the content to be sent
@ input the stream of bytes to be sent, which should be at least `length` bytes
Visibility: exportinterface Bytestream : Type -> Type- Parameters: a
Methods:
to_stream : Monad m => a -> (Nat, Stream (Of Bits8) m ())
Implementations:
Bytestream () Bytestream (List Bits8) Bytestream String
to_stream : Bytestream a => Monad m => a -> (Nat, Stream (Of Bits8) m ())- Visibility: public export
request : MonadError (HttpError e) m => HasIO m => Bytestream a => HttpClient e -> Method -> URL -> List (String, String) -> a -> m (HttpResponse, Stream (Of Bits8) m ()) Send a HTTP request, returns a `HttpResponse` containing the status code and headers,
and also a stream of the content body from the response.
Arguments:
@ client the HTTP client
@ method the HTTP method, e.g. GET / POST
@ url the URL to of the website to be connected to
@ headers the HTTP headers, represented as a list of (key, value)
@ payload the content payload of the request. Use () for empty content.
Visibility: export