From 8a5b0c697a6fdb3169afe82391368c26bec86978 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Wed, 25 Feb 2009 16:39:55 +0000 Subject: add js test suite for stats, enable access for a previously internal metric git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@747852 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/couch.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'share/www/script/couch.js') diff --git a/share/www/script/couch.js b/share/www/script/couch.js index 7bec5e32..8a0d3d23 100644 --- a/share/www/script/couch.js +++ b/share/www/script/couch.js @@ -312,20 +312,13 @@ CouchDB.request = function(method, uri, options) { return req; } -CouchDB.requestStats = function(module, key, aggregate, options) { - var options, optionsOrLast = Array.prototype.pop.apply(arguments); - if (typeof optionsOrLast == "string") { - options = null; - Array.prototype.push.apply(arguments, [optionsOrLast]); - } else { - options = optionsOrLast; +CouchDB.requestStats = function(module, key, test) { + var query_arg = ""; + if(test !== null) { + query_arg = "?flush=true"; } - var request_options = {}; - request_options.headers = {"Content-Type": "application/json"}; - - var stat = CouchDB.request("GET", "/_stats/" + Array.prototype.join.apply(arguments,["/"]) + (options ? - ("?" + CouchDB.params(options)) : ""), request_options).responseText; + var stat = CouchDB.request("GET", "/_stats/" + module + "/" + key + query_arg).responseText; return JSON.parse(stat)[module][key]; } -- cgit v1.2.3