From b10430e7d42d3c07f4e71ed7375d256cd5fccbf8 Mon Sep 17 00:00:00 2001 From: Johnson Denen Date: Tue, 18 Apr 2017 09:07:03 -0400 Subject: Add boost feature to timelines --- lisp/mastodon-http.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lisp/mastodon-http.el') 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. -- cgit v1.2.3