Small syntax sugar optimizations

This commit is contained in:
Miguel de la Cruz 2022-05-22 18:12:46 +02:00
parent ce0951fc45
commit 9d4bab5a20

View file

@ -40,7 +40,7 @@
(defun mattermost-login (username password)
"Log into the Mattermost Server"
(let ((url-request-method "POST")
(url-request-extra-headers `(("Content-Type" . "application/json")))
(url-request-extra-headers '(("Content-Type" . "application/json")))
(url-request-data (json-serialize (list :login_id username :password password))))
(with-current-buffer (url-retrieve-synchronously (concat mattermost-server-url "/api/v4/users/login"))
(beginning-of-buffer)
@ -59,7 +59,7 @@
(url-request-extra-headers `(("Content-Type" . "application/json")))
(url-request-data (if body (json-serialize body))))
(if mattermost-token
(add-to-list 'url-request-extra-headers (cons "Authorization" (concat "Bearer " mattermost-token))))
(add-to-list 'url-request-extra-headers `("Authorization" . ,(concat "Bearer " mattermost-token))))
(with-current-buffer (url-retrieve-synchronously (concat mattermost-server-url "/api/v4" url) t)
(mattermost-parse-json))))