summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Porter <adam@alphapapa.net>2025-03-18 18:35:34 -0500
committerAdam Porter <adam@alphapapa.net>2025-03-18 18:35:34 -0500
commite2d07838e3b64ee5ebe59d4c3c9011adefb7b58e (patch)
tree44a0b81339f9703b227901155e45f2fa7d58ae82
parent9fb22d84d9e39692392276d7b7b9979ca6ca1c01 (diff)
parent2867fba729a30d9859314a4abf0d18b957f86599 (diff)
Merge: Support HTTP PATCH methodexternals/plz
See #49.
-rw-r--r--README.org4
-rw-r--r--plz.el2
-rw-r--r--tests/test-plz.el14
3 files changed, 18 insertions, 2 deletions
diff --git a/README.org b/README.org
index 2705cbd..0afc1d0 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 903d71e..22cf6de 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 415edfd..7484cb2 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))