summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_httpd.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index 85fbe868..7b926019 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -97,6 +97,8 @@ handle_request0(Req, DocumentRoot, Method, Path) ->
handle_replicate_request(Req, Method);
"/_restart" ->
handle_restart_request(Req, Method);
+ "/_uuids" ->
+ handle_uuids_request(Req, Method);
"/_utils" ->
{ok, Req:respond({301, [
{"Location", "/_utils/"}
@@ -148,6 +150,17 @@ handle_restart_request(Req, 'POST') ->
handle_restart_request(_Req, _Method) ->
throw({method_not_allowed, "POST"}).
+handle_uuids_request(Req, 'POST') ->
+ Count = list_to_integer(proplists:get_value("count", Req:parse_qs(), "1")),
+ % generate the uuids
+ UUIDs = [ couch_util:new_uuid() || _ <- lists:seq(1,Count)],
+ % send a JSON response
+ send_json(Req, {obj, [{"uuids", list_to_tuple(UUIDs)}]});
+
+handle_uuids_request(_Req, _Method) ->
+ throw({method_not_allowed, "POST"}).
+
+
% Database request handlers
handle_db_request(Req, Method, {Path}) ->