Net.Http
eff HttpSourceThe effect used to send HTTP requests (both http:// and https://).
Operations
Definitions
Sends a DELETE request to the given url.
Sends a GET request to the given url.
Handles the Http effect of the given function f.
Re-interprets the Http effect using the IO effect.
Sends a HEAD request to the given url.
Sends an OPTIONS request to the given url.
Sends a PATCH request to the given url with the given body.
Sends a POST request to the given url with the given body.
Sends a PUT request to the given url with the given body.
@DefaultHandler Runs the Http effect of the given function f.
Re-interprets the Http effect using the IO effect.
Sends the given request req via the Http effect.
Middleware that intercepts the Http effect, prepending base to
request URLs that do not already start with a scheme. Absolute URLs
(where "://" appears before the first "/") are left unchanged.
def withCircuitBreaker(ft: { failureThreshold = Int32 }, cdm: { cooldown = Duration }, f: Unit -> a \ ef): a \ (ef - Http) + Clock + Http§ SourceMiddleware that intercepts the Http effect, implementing a circuit breaker.
Tracks consecutive failures (transport errors and 5xx server errors).
After failureThreshold consecutive failures, the circuit opens and
immediately rejects requests for cooldown.
After the cooldown, one probe request is allowed through (half-open state).
A successful probe closes the circuit; a failed probe restarts the cooldown.
Non-failure responses (2xx, 3xx, 4xx) reset the failure counter.
def withDefaultHeaders(defaults: Map[String, List[String]], f: Unit -> a \ ef): a \ (ef - Http) + Http§ SourceMiddleware that intercepts the Http effect, injecting default headers
into every request. Headers already present on the request are not overridden.
Middleware that intercepts the Http effect, logging each request
and its corresponding response via the Logger effect at Debug level.
def withMinInterval(ims: { interval = Duration }, f: Unit -> a \ ef): a \ (ef - Http) + Clock + Http§ SourceMiddleware that intercepts the Http effect, enforcing a minimum interval
between consecutive HTTP requests.
def withRetry(strategy: Int32 -> (HttpRequest -> (RetryOutcome -> RetryDecision \ ef1)), f: Unit -> a \ ef2): a \ ef1 + (ef2 - Http) + Http§ SourceMiddleware that intercepts the Http effect, adding retry logic.
The strategy function decides whether to retry and how long to wait.
Each Http.request is re-raised to an outer Http handler that performs the actual I/O.
def withSlidingWindow(mr: { maxRequests = Int32 }, wms: { window = Duration }, f: Unit -> a \ ef): a \ (ef - Http) + Clock + Http§ SourceMiddleware that intercepts the Http effect, enforcing a sliding-window
rate limit. Allows at most maxRequests within any rolling window.
When the limit is reached, sleeps until the oldest request expires.
def withTokenBucket(bs: { burstSize = Int32 }, ims: { interval = Duration }, f: Unit -> a \ ef): a \ (ef - Http) + Clock + Http§ SourceMiddleware that intercepts the Http effect, enforcing a token-bucket
rate limit. Allows an initial burst of burstSize requests, then
sustains at 1 request per interval.