aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-http.el
diff options
context:
space:
mode:
authorJohnson Denen <johnson.denen@gmail.com>2017-04-18 09:07:03 -0400
committerJohnson Denen <johnson.denen@gmail.com>2017-04-18 10:44:40 -0400
commitb10430e7d42d3c07f4e71ed7375d256cd5fccbf8 (patch)
tree67b836f431f6a5db8d77f2166c449af4307056b1 /lisp/mastodon-http.el
parent9c2d6230993340d13f85be99dcc128e09e73058a (diff)
Add boost feature to timelines
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r--lisp/mastodon-http.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 35af12c..50b560f 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -108,6 +108,25 @@ If response code is not 2XX, switches to the response buffer created by `url-ret
(funcall success)
(switch-to-buffer (current-buffer))))
+(defun mastodon-http--post (url args headers)
+ "POST synchronously to URL with ARGS and HEADERS.
+
+Authorization header is included by default."
+ (let ((url-request-method "POST")
+ (url-request-data
+ (when args
+ (mapconcat (lambda (arg)
+ (concat (url-hexify-string (car arg))
+ "="
+ (url-hexify-string (cdr arg))))
+ args
+ "&")))
+ (url-request-extra-headers
+ `(("Authorization" . ,(concat "Bearer " (mastodon--access-token)))
+ ,headers)))
+ (with-temp-buffer
+ (url-retrieve-synchronously url))))
+
(defun mastodon-http--get (url)
"Make GET request to URL.