Module
Network.HTTP.Affjax
- Package
- purescript-affjax
- Repository
- slamdata/purescript-affjax
#Affjax Source
type Affjax a = Aff (AffjaxResponse a)
The result type for Affjax requests.
#AffjaxRequest Source
type AffjaxRequest = { content :: Maybe Request, headers :: Array RequestHeader, method :: Either Method CustomMethod, password :: Maybe String, url :: URL, username :: Maybe String, withCredentials :: Boolean }
#AffjaxResponse Source
type AffjaxResponse a = { headers :: Array ResponseHeader, response :: a, status :: StatusCode, statusText :: String }
The type of records that will be received as an Affjax response.
#RetryDelayCurve Source
type RetryDelayCurve = Int -> Milliseconds
A sequence of retry delays, in milliseconds.
#RetryPolicy Source
type RetryPolicy = { delayCurve :: RetryDelayCurve, shouldRetryWithStatusCode :: StatusCode -> Boolean, timeout :: Maybe Milliseconds }
Expresses a policy for retrying Affjax requests with backoff.
#defaultRetryPolicy Source
defaultRetryPolicy :: RetryPolicy
A sensible default for retries: no timeout, maximum delay of 30s, initial delay of 0.1s, exponential backoff, and no status code triggers a retry.
#retry Source
retry :: forall a. RetryPolicy -> (AffjaxRequest -> Affjax a) -> AffjaxRequest -> Affjax a
Retry a request using a RetryPolicy
. After the timeout, the last received response is returned; if it was not possible to communicate with the server due to an error, then this is bubbled up.