aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-http.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-10-24 10:01:46 +0200
committermousebot <mousebot@riseup.net>2021-10-24 10:01:46 +0200
commit36f9fe238b778d76809facd3d66120c2166f2c30 (patch)
treed8ff1355c03fd03b99d65ebf6c037c05b74b1443 /lisp/mastodon-http.el
parent5cd25e89696dc3aa5db5b4f36bae317547c69802 (diff)
parent67e515edbbaa660757ecdcf87bbdfe353eb652f2 (diff)
Merge branch 'develop' into imgcaching
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r--lisp/mastodon-http.el16
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index f092a2d..4f4cc3f 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -90,6 +90,12 @@ Message status and JSON error from RESPONSE if unsuccessful."
(let ((json-response (mastodon-http--process-json)))
(message "Error %s: %s" status (cdr (assoc 'error json-response))))))))
+(defun mastodon-http--read-file-as-string (filename)
+ "Read a file FILENAME as a string. Used to generate image preview."
+ (with-temp-buffer
+ (insert-file-contents filename)
+ (string-to-unibyte (buffer-string))))
+
(defun mastodon-http--post (url args headers &optional unauthenticed-p)
"POST synchronously to URL with ARGS and HEADERS.
@@ -113,12 +119,6 @@ Authorization header is included by default unless UNAUTHENTICED-P is non-nil."
(url-retrieve-synchronously url)
(url-retrieve-synchronously url nil nil mastodon-http--timeout)))))
-(defun mastodon-http--read-file-as-string (filename)
- "Read a file FILENAME as a string. Used to generate image preview."
- (with-temp-buffer
- (insert-file-contents filename)
- (string-to-unibyte (buffer-string))))
-
(defun mastodon-http--get (url)
"Make synchronous GET request to URL.
@@ -223,7 +223,7 @@ Pass response buffer to CALLBACK function with args CBARGS."
(url-request-extra-headers
`(("Authorization" . ,(concat "Bearer "
(mastodon-auth--access-token))))))
- (url-retrieve url callback cbargs mastodon-http--timeout)))
+ (url-retrieve url callback cbargs)))
(defun mastodon-http--get-json-async (url &optional callback &rest args)
"Make GET request to URL. Call CALLBACK with json-vector and ARGS."
@@ -251,7 +251,7 @@ Authorization header is included by default unless UNAUTHENTICED-P is non-nil."
(append `(("Authorization" . ,(concat "Bearer " (mastodon-auth--access-token))))
headers)))
(with-temp-buffer
- (url-retrieve url callback cbargs mastodon-http--timeout))))
+ (url-retrieve url callback cbargs))))
;; TODO: test for curl first?
(defun mastodon-http--post-media-attachment (url filename caption)