Skip to content

Commit 279fbd6

Browse files
author
Alex Gryzlov
committed
add wrapper method for PATCH
1 parent 85a561e commit 279fbd6

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/Network/HTTP/Affjax.purs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,24 @@ delete u = affjax $ defaultRequest { method = Left DELETE, url = u }
140140
delete_ :: forall e. URL -> Affjax e Unit
141141
delete_ = delete
142142

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

@@ -292,4 +310,3 @@ foreign import _cancelAjax
292310
(Error -> Eff (ajax :: AJAX | e) Unit)
293311
(Boolean -> Eff (ajax :: AJAX | e) Unit)
294312
(Eff (ajax :: AJAX | e) Unit)
295-

0 commit comments

Comments
 (0)