Skip to content

Commit

Permalink
get-document with an empty key now returns nil (gh-62)
Browse files Browse the repository at this point in the history
  • Loading branch information
cemerick committed Oct 10, 2012
1 parent a77c878 commit 2a2ac94
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/com/ashafa/clutch.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 2a2ac94

Please sign in to comment.