From df6320f5174e610f1eb281ff619fd88a5fb1ba6a Mon Sep 17 00:00:00 2001 From: Johnson Denen Date: Thu, 20 Apr 2017 11:41:41 -0400 Subject: Close #11 with new callbacks --- lisp/mastodon-http.el | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lisp/mastodon-http.el') diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index 50b560f..92c876f 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -108,6 +108,13 @@ 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--triage (response success) + (let ((status (with-current-buffer response + (mastodon--response-code)))) + (if (string-prefix-p "2" status) + (funcall success) + (switch-to-buffer response)))) + (defun mastodon-http--post (url args headers) "POST synchronously to URL with ARGS and HEADERS. -- cgit v1.2.3