aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-http.el
diff options
context:
space:
mode:
authorH Durer <h.duerer@gmail.com>2018-03-02 20:25:15 +0000
committerGitHub <noreply@github.com>2018-03-02 20:25:15 +0000
commitca4bb2a436f1ba46515b812c97d74333294bae76 (patch)
treeda489813900e660e5d9460ed1a9c9b13869d344a /lisp/mastodon-http.el
parent3e9bdbf2eeecafd7bb0673f2709f816a740c7d61 (diff)
parentb1f05c07c8f00e4546b1ff07be47537660a0b5f6 (diff)
Merge pull request #154 from hdurer/multi-instance-in-plstore
Keep track of to which instance secrets in plstore belong
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r--lisp/mastodon-http.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index f519e20..905a853 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -31,7 +31,6 @@
(require 'json)
(defvar mastodon-instance-url)
-(defvar mastodon-auth--token)
(autoload 'mastodon-auth--access-token "mastodon-auth")
(defvar mastodon-http--api-version "v1")
@@ -68,10 +67,10 @@ Open RESPONSE buffer if unsuccessful."
(funcall success)
(switch-to-buffer response))))
-(defun mastodon-http--post (url args headers)
+(defun mastodon-http--post (url args headers &optional unauthenticed-p)
"POST synchronously to URL with ARGS and HEADERS.
-Authorization header is included by default."
+Authorization header is included by default unless UNAUTHENTICED-P is non-nil."
(let ((url-request-method "POST")
(url-request-data
(when args
@@ -82,8 +81,10 @@ Authorization header is included by default."
args
"&")))
(url-request-extra-headers
- `(("Authorization" . ,(concat "Bearer " mastodon-auth--token))
- ,headers)))
+ (append
+ (unless unauthenticed-p
+ `(("Authorization" . (concat "Bearer " (mastodon-auth--access-token)))))
+ headers)))
(with-temp-buffer
(url-retrieve-synchronously url))))