branch: externals/plz
commit e2d07838e3b64ee5ebe59d4c3c9011adefb7b58e
Merge: 9fb22d84d9 2867fba729
Author: Adam Porter <[email protected]>
Commit: Adam Porter <[email protected]>
Merge: Support HTTP PATCH method
See #49.
---
README.org | 4 +++-
plz.el | 2 +-
tests/test-plz.el | 14 ++++++++++++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/README.org b/README.org
index 2705cbddc3..0afc1d0e97 100644
--- a/README.org
+++ b/README.org
@@ -190,7 +190,9 @@ You may also clear a queue with ~plz-clear~, which cancels
any active or queued
** 0.10-pre
-Nothing new yet.
+*Additions*
+
++ Support for the HTTP PATCH method.
([[https://github.com/alphapapa/plz.el/pull/49][#49]]. Thanks to
[[https://github.com/fpvmorais][Pedro Morais]].)
** 0.9.1
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))