branch: externals/plz
commit b9342b3f0133e6353ff0e02066dbfc3b9d5bf43f
Author: Pedro Morais <fpvmor...@gmail.com>
Commit: Adam Porter <a...@alphapapa.net>

    Added PATCH method
---
 plz.el            |  2 +-
 tests/test-plz.el | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/plz.el b/plz.el
index 903d71e6b9..22cf6debf1 100644
--- a/plz.el
+++ b/plz.el
@@ -456,7 +456,7 @@ into the process buffer.
                                       ;; requests which output to the terminal.
                                       (list (cons "--dump-header" 
null-device))))
                                    (pcase method
-                                     ((or 'put 'post)
+                                     ((or 'put 'post 'patch)
                                       (list
                                        ;; It appears that this must be the 
last argument
                                        ;; in order to pass data on the rest of 
STDIN.
diff --git a/tests/test-plz.el b/tests/test-plz.el
index 415edfd6f5..7484cb284c 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -171,6 +171,20 @@ in URL-encoded form)."
       (should (string-match "curl" .headers.User-Agent))
       (should (string= "value" (alist-get 'key (json-read-from-string 
.data)))))))
 
+(plz-deftest plz-patch-json-string nil
+  (let* ((json-string (json-encode (list (cons "key" "value"))))
+         (response-json)
+         (process (plz 'patch (url "/patch")
+                    :headers '(("Content-Type" . "application/json"))
+                    :body json-string
+                    :as #'json-read
+                    :then (lambda (json)
+                            (setf response-json json)))))
+    (plz-test-wait process)
+    (let-alist response-json
+      (should (string-match "curl" .headers.User-Agent))
+      (should (string= "value" (alist-get 'key (json-read-from-string 
.data)))))))
+
 (plz-deftest plz-post-jpeg-string nil
   (let* ((jpeg-to-upload (plz 'get (url "/image/jpeg")
                            :as 'binary :then 'sync))

Reply via email to