diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-10-01 22:21:32 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-10-01 22:21:32 +0200 |
commit | 2487b589292976f830325eea39765beb44e4036a (patch) | |
tree | c24582775bec3b8c2d0df4acb826ce6f5de069df | |
parent | db078f72b7d176f18e24792e93319322b02795bb (diff) |
http--post: if :json, supply required headers
-rw-r--r-- | lisp/mastodon-http.el | 10 | ||||
-rw-r--r-- | lisp/mastodon-profile.el | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index 546d5bd..c1b0599 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -157,16 +157,18 @@ the request data. If it is :raw, just use the plain params." (let* ((url-request-data (when params (cond ((eq json :json) - (json-encode - params)) + (json-encode params)) ((eq json :raw) params) (t (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"))) + (if json + '(("Content-Type" . "application/json") + ("Accept" . "application/json")) + (unless (assoc "Content-Type" headers) ; pleroma compat: + '(("Content-Type" . "application/x-www-form-urlencoded")))) headers))) (with-temp-buffer (mastodon-http--url-retrieve-synchronously url))) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 6410591..ce7fddd 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -386,6 +386,8 @@ This is done after changing the setting on the server." Only do so if `mastodon-profile-account-settings' is nil." (mastodon-profile--fetch-server-account-settings :no-force)) +;; FIXME: this does one request per setting! should just do one request then +;; parse (defun mastodon-profile--fetch-server-account-settings (&optional no-force) "Fetch basic account settings from the server. Store the values in `mastodon-profile-account-settings'. |