From 55ee8c7f9188443900c52a69ae408bcf457be62a Mon Sep 17 00:00:00 2001 From: "Damien F. Katz" Date: Mon, 19 May 2008 19:20:19 +0000 Subject: Changed temp view definition to always be jsonobjects with map/reduce source as members of the object. Everywhere we used 'text/javascript' or 'application/javascript', we now just use 'javascript' git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@657926 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/browse.js | 2 +- share/www/script/couch.js | 8 ++++---- share/www/script/couch_tests.js | 2 +- share/www/script/jquery.couch.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'share') diff --git a/share/www/script/browse.js b/share/www/script/browse.js index b08cbae6..9d821d09 100644 --- a/share/www/script/browse.js +++ b/share/www/script/browse.js @@ -277,7 +277,7 @@ function CouchDatabasePage() { var viewCode = $("#viewcode textarea").val(); var docId = ["_design", data.docid].join("/"); function save(doc) { - if (!doc) doc = {_id: docId, language: "text/javascript"}; + if (!doc) doc = {_id: docId, language: "javascript"}; if (doc.views === undefined) doc.views = {}; doc.views[data.name] = viewCode; db.saveDoc(doc, { diff --git a/share/www/script/couch.js b/share/www/script/couch.js index f72fb712..d63f1eae 100644 --- a/share/www/script/couch.js +++ b/share/www/script/couch.js @@ -98,8 +98,8 @@ function CouchDB(name) { if (typeof(mapFun) != "string") mapFun = mapFun.toSource ? mapFun.toSource() : "(" + mapFun.toString() + ")"; var req = request("POST", this.uri + "_temp_view" + encodeOptions(options), { - headers: {"Content-Type": "text/javascript"}, - body: JSON.stringify(mapFun) + headers: {"Content-Type": "application/json"}, + body: JSON.stringify({language:"javascript",map:mapFun}) }); var result = JSON.parse(req.responseText); if (req.status != 200) @@ -114,8 +114,8 @@ function CouchDB(name) { if (typeof(reduceFun) != "string") reduceFun = reduceFun.toSource ? reduceFun.toSource() : "(" + reduceFun.toString() + ")"; var req = request("POST", this.uri + "_temp_view" + encodeOptions(options), { - headers: {"Content-Type": "text/javascript"}, - body: JSON.stringify({map:mapFun, reduce:reduceFun}) + headers: {"Content-Type": "application/json"}, + body: JSON.stringify({language:"javascript",map:mapFun,reduce:reduceFun}) }); var result = JSON.parse(req.responseText); if (req.status != 200) diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index 72ed9f58..7b35cf87 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -436,7 +436,7 @@ var tests = { var designDoc = { _id:"_design/test", - language: "text/javascript", + language: "javascript", views: { all_docs: "function(doc) { map(doc.integer, null) }", no_docs: "function(doc) {}", diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index de1cddc9..00090619 100644 --- a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -179,7 +179,7 @@ fun = fun.toSource ? fun.toSource() : "(" + fun.toString() + ")"; $.ajax({ type: "POST", url: this.uri + "_temp_view" + encodeOptions(options), - contentType: "text/javascript", data: fun, dataType: "json", + contentType: "javascript", data: fun, dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); if (req.status == 200 && options.success) { -- cgit v1.2.3