]> code.delx.au - gnu-emacs-elpa/commitdiff
oauth2: allow to use any HTTP request type
authorJulien Danjou <julien@danjou.info>
Tue, 20 Dec 2011 10:30:30 +0000 (11:30 +0100)
committerJulien Danjou <julien@danjou.info>
Tue, 20 Dec 2011 10:30:30 +0000 (11:30 +0100)
* oauth2: allow to use any HTTP request type

packages/oauth2/oauth2.el

index 3b57c05c17664374b6cc0f15bafcdc521e6090e1..7175606f74d98f219b86dafd518e776fb9c3bc4e 100644 (file)
@@ -178,7 +178,7 @@ This allows to store the token in an unique way."
 (defvar success)
 
 ;;;###autoload
-(defun oauth2-url-retrieve-synchronously (token url)
+(defun oauth2-url-retrieve-synchronously (token url &optional request-method request-data request-extra-headers)
   "Retrieve an URL synchronously using TOKENS to access it.
 TOKENS can be obtained with `oauth2-auth'."
   (let (tokens-need-renew)
@@ -187,10 +187,14 @@ TOKENS can be obtained with `oauth2-auth'."
                                            ;; This is to make `url' think
                                            ;; it's done.
                                            (setq success t)))
-      (let ((url-buffer (url-retrieve-synchronously
-                         (oauth2-url-append-access-token token url))))
+      (let ((url-request-method request-method)
+            (url-request-data request-data)
+            (url-request-extra-headers request-extra-headers)
+            (url-buffer))
+        (setq url-buffer (url-retrieve-synchronously
+                          (oauth2-url-append-access-token token url)))
         (if tokens-need-renew
-            (oauth2-url-retrieve-synchronously (oauth2-refresh-access token) url)
+              (oauth2-url-retrieve-synchronously (oauth2-refresh-access token) url request-method request-data request-extra-headers)
           url-buffer)))))
 
 (provide 'oauth2)