branch: elpa/fedi
commit 76a630113de90f3e8f1af5216b1d737d90a42577
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>

    http: add json arg to delete
---
 fedi-http.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/fedi-http.el b/fedi-http.el
index 5e456a5667c..629c9e7df10 100644
--- a/fedi-http.el
+++ b/fedi-http.el
@@ -172,12 +172,19 @@ json-string PARAMS."
     (with-temp-buffer
       (fedi-http--url-retrieve-synchronously url silent))))
 
-(defun fedi-http--delete (url &optional params)
+(defun fedi-http--delete (url &optional params json)
   "Make DELETE request to URL.
-PARAMS is an alist of any extra parameters to send with the request."
+PARAMS is an alist of any extra parameters to send with the request.
+If JSON, encode PARAMS as JSON."
   ;; url-request-data only works with POST requests?
   (let ((url-request-method "DELETE")
-        (url (fedi-http--concat-params-to-url url params)))
+        (url-request-data
+         (when params
+           (if json
+               (encode-coding-string
+                (json-encode params) 'utf-8)
+             (fedi-http--build-params-string params)))))
+    ;; (url (fedi-http--concat-params-to-url url params)))
     (with-temp-buffer
       (fedi-http--url-retrieve-synchronously url))))
 

Reply via email to