Skip to content

Commit 7048b49

Browse files
authored
Merge pull request #77 from clayrat/master
Add wrappers for HTTP PATCH
2 parents 85a561e + 359f37a commit 7048b49

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/Network/HTTP/Affjax.purs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module Network.HTTP.Affjax
1010
, post, post_, post', post_'
1111
, put, put_, put', put_'
1212
, delete, delete_
13+
, patch, patch_, patch', patch_'
1314
, RetryDelayCurve()
1415
, RetryPolicy(..)
1516
, defaultRetryPolicy
@@ -140,6 +141,24 @@ delete u = affjax $ defaultRequest { method = Left DELETE, url = u }
140141
delete_ :: forall e. URL -> Affjax e Unit
141142
delete_ = delete
142143

144+
-- | Makes a `PATCH` request to the specified URL, sending data.
145+
patch :: forall e a b. (Requestable a, Respondable b) => URL -> a -> Affjax e b
146+
patch u c = affjax $ defaultRequest { method = Left PATCH, url = u, content = Just c }
147+
148+
-- | Makes a `PATCH` request to the specified URL with the option to send data.
149+
patch' :: forall e a b. (Requestable a, Respondable b) => URL -> Maybe a -> Affjax e b
150+
patch' u c = affjax $ defaultRequest { method = Left PATCH, url = u, content = c }
151+
152+
-- | Makes a `PATCH` request to the specified URL, sending data and ignoring the
153+
-- | response.
154+
patch_ :: forall e a. (Requestable a) => URL -> a -> Affjax e Unit
155+
patch_ = patch
156+
157+
-- | Makes a `PATCH` request to the specified URL with the option to send data,
158+
-- | and ignores the response.
159+
patch_' :: forall e a. (Requestable a) => URL -> Maybe a -> Affjax e Unit
160+
patch_' = patch'
161+
143162
-- | A sequence of retry delays, in milliseconds.
144163
type RetryDelayCurve = Int -> Int
145164

@@ -292,4 +311,3 @@ foreign import _cancelAjax
292311
(Error -> Eff (ajax :: AJAX | e) Unit)
293312
(Boolean -> Eff (ajax :: AJAX | e) Unit)
294313
(Eff (ajax :: AJAX | e) Unit)
295-

0 commit comments

Comments
 (0)