[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mastodon cada9d84d1 02/22: port fedi-http handling of POST
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mastodon cada9d84d1 02/22: port fedi-http handling of POST JSON data or not |
Date: |
Thu, 5 Oct 2023 07:00:53 -0400 (EDT) |
branch: elpa/mastodon
commit cada9d84d13e0df5eeafa97f00e34c56a46473b8
Author: marty hiatt <martianhiatus [a t] riseup [d o t] net>
Commit: marty hiatt <martianhiatus [a t] riseup [d o t] net>
port fedi-http handling of POST JSON data or not
---
lisp/mastodon-http.el | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index ab621a2d47..cb4c32396c 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -127,17 +127,20 @@ Used for API form data parameters that take an array."
(cl-loop for x in array
collect (cons param-str x)))
-(defun mastodon-http--post (url &optional params headers unauthenticated-p)
+(defun mastodon-http--post (url &optional params headers unauthenticated-p
json)
"POST synchronously to URL, optionally with PARAMS and HEADERS.
Authorization header is included by default unless UNAUTHENTICATED-P is
non-nil."
(mastodon-http--authorized-request "POST"
- (let ((url-request-data (when params
- (mastodon-http--build-params-string params)))
- (url-request-extra-headers
- (append url-request-extra-headers ; auth set in macro
- (unless (assoc "Content-Type" headers) ; pleroma compat:
- '(("Content-Type" . "application/x-www-form-urlencoded")))
- headers)))
+ (let* ((url-request-data
+ (when params
+ (if json
+ (json-encode params)
+ (fedi-http--build-params-string params))))
+ (url-request-extra-headers
+ (append url-request-extra-headers ; auth set in macro
+ (unless (assoc "Content-Type" headers) ; pleroma compat:
+ '(("Content-Type" .
"application/x-www-form-urlencoded")))
+ headers)))
(with-temp-buffer
(mastodon-http--url-retrieve-synchronously url)))
unauthenticated-p))
- [nongnu] elpa/mastodon updated (5e12dc9985 -> b8c5e9d50d), ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon a440c4c134 01/22: add misskey notes regex to masto-url-p, ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon f4cd336db1 07/22: readme re server compat, ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon cada9d84d1 02/22: port fedi-http handling of POST JSON data or not,
ELPA Syncer <=
- [nongnu] elpa/mastodon ccd3015d08 06/22: readme, ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon 10ca848cdd 08/22: add ELPA badge, ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon db05397202 03/22: add mastodon-views--instance-desc-misskey. TODO merge with other inst funs, ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon 63f55bb016 10/22: refactor mode function, to avoid multiple addition of lambda., ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon 1964ee8ad6 13/22: bump version, ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon 5d46e17c0b 20/22: indent -toot.el, ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon d39903ddcc 17/22: bump version, ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon e8f10073a6 18/22: bump version, ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon bf656bd333 19/22: rear-nonsticky only for \n at end of compose header., ELPA Syncer, 2023/10/05
- [nongnu] elpa/mastodon 083222c20c 21/22: bump, ELPA Syncer, 2023/10/05