From af094f6ffe44fc10aa2af2702b648a37d9444665 Mon Sep 17 00:00:00 2001 From: Hugo Duncan Date: Sun, 19 Sep 2010 11:15:22 -0400 Subject: [PATCH] Added sign-blob-request overload for default get request --- blobstore/src/main/clojure/org/jclouds/blobstore.clj | 7 +++++-- blobstore/src/test/clojure/org/jclouds/blobstore_test.clj | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/blobstore/src/main/clojure/org/jclouds/blobstore.clj b/blobstore/src/main/clojure/org/jclouds/blobstore.clj index cf670acab4..8b626ff69a 100644 --- a/blobstore/src/main/clojure/org/jclouds/blobstore.clj +++ b/blobstore/src/main/clojure/org/jclouds/blobstore.clj @@ -241,11 +241,14 @@ Options can also be specified for extension modules (defn sign-blob-request "Get a signed http request for manipulating a blob in another application. - ex. curl. + ex. curl. The default is for a :get request. The request argument is used to specify charecteristics of the request to be signed. The :method key must be set to one of :get, :delete, and :put. For :put requests, :content-length must be specified. Optionally, - :content-type and content-md5 may be given." + :content-type, :content-disposition, :content-language, :content-encoding + and :content-md5 may be given." + ([container-name path] + (sign-blob-request container-name path {:method :get} *blobstore*)) ([container-name path {:keys [method content-type content-length content-md5 content-disposition content-encoding content-language] :as request}] diff --git a/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj b/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj index 71ef17b51d..d75fa91c7e 100644 --- a/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj +++ b/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj @@ -112,9 +112,15 @@ (deftest sign-blob-request-test (testing "delete" (let [request (sign-blob-request "container" "path" {:method :delete})] + (is (= "http://localhost/container/path" (str (.getEndpoint request)))) (is (= "DELETE" (.getMethod request))))) + (testing "default request" + (let [request (sign-blob-request "container" "path")] + (is (= "http://localhost/container/path" (str (.getEndpoint request)))) + (is (= "GET" (.getMethod request))))) (testing "get" (let [request (sign-blob-request "container" "path" {:method :get})] + (is (= "http://localhost/container/path" (str (.getEndpoint request)))) (is (= "GET" (.getMethod request))))) (testing "put" (let [request (sign-blob-request