branch: elpa/gptel
commit 1777f088614e32dd8f4754d5993c3b21c97201a5
Author: skittishdev <[email protected]>
Commit: GitHub <[email protected]>
gptel: Do not send data with GET request (#1208)
gptel.el (gptel--url-retrieve): Don't include request data when making
a GET request. This also aligns with RFC9110 which strongly
discourages sending content with a GET request.
https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.1-6
---
gptel-request.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gptel-request.el b/gptel-request.el
index 5a4bfb88e70..c8908887a4f 100644
--- a/gptel-request.el
+++ b/gptel-request.el
@@ -884,8 +884,8 @@ MODE-SYM is typically a major-mode symbol."
(cl-defun gptel--url-retrieve (url &key method data headers)
"Retrieve URL synchronously with METHOD, DATA and HEADERS."
(declare (indent 1))
- (let ((url-request-method (if (eq method'post) "POST" "GET"))
- (url-request-data (encode-coding-string (gptel--json-encode data)
'utf-8))
+ (let ((url-request-method (if (eq method 'post) "POST" "GET"))
+ (url-request-data (when (eq method 'post) (encode-coding-string
(gptel--json-encode data) 'utf-8)))
(url-mime-accept-string "application/json")
(url-request-extra-headers
`(("content-type" . "application/json")