Skip to content

Commit 6a8f6e2

Browse files
committed
Rename RequestOptions to Request
1 parent 36e8b71 commit 6a8f6e2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Affjax.purs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Affjax
2-
( RequestOptions, defaultRequest
2+
( Request, defaultRequest
33
, Response
44
, URL
55
, request
@@ -52,7 +52,7 @@ import Math as Math
5252
-- | A record that contains all the information to perform an HTTP request.
5353
-- | Instead of constructing the record from scratch it is often easier to build
5454
-- | one based on `defaultRequest`.
55-
type RequestOptions =
55+
type Request =
5656
{ method :: Either Method CustomMethod
5757
, url :: URL
5858
, headers :: Array RequestHeader
@@ -62,18 +62,18 @@ type RequestOptions =
6262
, withCredentials :: Boolean
6363
}
6464

65-
-- | A record of the type `RequestOptions` that has all fields set to default
65+
-- | A record of the type `Request` that has all fields set to default
6666
-- | values. This record can be used as the foundation for constructing
6767
-- | custom requests.
6868
-- |
69-
-- | As an example
69+
-- | As an example:
7070
-- |
7171
-- | ```purescript
7272
-- | defaultRequest { url = "/api/user", method = Left POST }
7373
-- | ```
7474
-- |
75-
-- | Represents a POST request to the URL `/api/user`.
76-
defaultRequest :: RequestOptions
75+
-- | Would represents a POST request to the URL `/api/user`.
76+
defaultRequest :: Request
7777
defaultRequest =
7878
{ method: Left GET
7979
, url: "/"
@@ -183,7 +183,7 @@ defaultRetryPolicy =
183183
type RetryState e a = Either (Either e a) a
184184

185185
-- | 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.
186-
retry :: forall a. RetryPolicy -> (RequestOptions -> Aff (Response a)) -> RequestOptions -> Aff (Response a)
186+
retry :: forall a. RetryPolicy -> (Request -> Aff (Response a)) -> Request -> Aff (Response a)
187187
retry policy run req = do
188188
-- failureRef is either an exception or a failed request
189189
failureRef <- liftEffect $ Ref.new Nothing
@@ -238,7 +238,7 @@ retry policy run req = do
238238
-- | ```purescript
239239
-- | get json "/resource"
240240
-- | ```
241-
request :: forall a. ResponseFormat.ResponseFormat a -> RequestOptions -> Aff (Response (Either ResponseFormatError a))
241+
request :: forall a. ResponseFormat.ResponseFormat a -> Request -> Aff (Response (Either ResponseFormatError a))
242242
request rt req = do
243243
res <- AC.fromEffectFnAff $ runFn2 _ajax responseHeader req'
244244
case runExcept (fromResponse' res.body) of

0 commit comments

Comments
 (0)