From 2a2ac94d808212a7f0e6494e57d658b3f50eaa6f Mon Sep 17 00:00:00 2001 From: Chas Emerick Date: Wed, 10 Oct 2012 07:45:31 -0400 Subject: [PATCH] get-document with an empty key now returns nil (gh-62) --- src/com/ashafa/clutch.clj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/com/ashafa/clutch.clj b/src/com/ashafa/clutch.clj index 7850cdf..26a83ed 100644 --- a/src/com/ashafa/clutch.clj +++ b/src/com/ashafa/clutch.clj @@ -166,9 +166,11 @@ "Returns the document identified by the given id. Optional CouchDB document API query parameters (rev, attachments, may be provided as keyword arguments." [db id & {:as get-params}] - (couchdb-request :get - (-> (utils/url db id) - (assoc :query get-params)))) + ;; TODO a nil or empty key should probably just throw an exception + (when (seq id) + (couchdb-request :get + (-> (utils/url db id) + (assoc :query get-params))))) (defn- document? [x]