summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-07-04 16:19:23 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-07-04 16:19:23 +0000
commit887955a951470a9dc211c6e404905292f1a39585 (patch)
tree2b9c8730672938316cba1c525438dba86a04f398 /share
parentf6fd760c17cb5d5d49211be4b4ff92e797e83157 (diff)
send utf-8 hearders with list and show responses. closes COUCHDB-392
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791145 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r--share/server/render.js4
-rw-r--r--share/www/script/test/list_views.js2
-rw-r--r--share/www/script/test/show_documents.js16
3 files changed, 12 insertions, 10 deletions
diff --git a/share/server/render.js b/share/server/render.js
index 99541eab..b3a24bde 100644
--- a/share/server/render.js
+++ b/share/server/render.js
@@ -166,8 +166,8 @@ registerType = function() {
// http://dev.rubyonrails.org/svn/rails/trunk/actionpack/lib/action_controller/mime_types.rb
registerType("all", "*/*");
-registerType("text", "text/plain", "txt");
-registerType("html", "text/html");
+registerType("text", "text/plain; charset=utf-8", "txt");
+registerType("html", "text/html; charset=utf-8");
registerType("xhtml", "application/xhtml+xml", "xhtml");
registerType("xml", "application/xml", "text/xml", "application/x-xml");
registerType("js", "text/javascript", "application/javascript", "application/x-javascript");
diff --git a/share/www/script/test/list_views.js b/share/www/script/test/list_views.js
index 2b7e4cb3..bbe0814c 100644
--- a/share/www/script/test/list_views.js
+++ b/share/www/script/test/list_views.js
@@ -312,7 +312,7 @@ couchTests.list_views = function(debug) {
"Accept": 'text/html'
}
});
- T(xhr.getResponseHeader("Content-Type") == "text/html");
+ T(xhr.getResponseHeader("Content-Type") == "text/html; charset=utf-8");
T(xhr.responseText.match(/HTML/));
T(xhr.responseText.match(/Value/));
diff --git a/share/www/script/test/show_documents.js b/share/www/script/test/show_documents.js
index 18dcc0b3..64a6788f 100644
--- a/share/www/script/test/show_documents.js
+++ b/share/www/script/test/show_documents.js
@@ -143,10 +143,7 @@ couchTests.show_documents = function(debug) {
// hello template world
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/hello/"+docid);
T(xhr.responseText == "Hello World");
-//
-// };
-//
-// function foo() {
+ T(/charset=utf-8/.test(xhr.getResponseHeader("Content-Type")))
// Fix for COUCHDB-379
T(equals(xhr.getResponseHeader("Server").substr(0,7), "CouchDB"));
@@ -207,7 +204,8 @@ couchTests.show_documents = function(debug) {
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/accept-switch/"+docid, {
headers: {"Accept": "text/html;text/plain;*/*"}
});
- T("text/html" == xhr.getResponseHeader("Content-Type"));
+ var ct = xhr.getResponseHeader("Content-Type");
+ T(/text\/html/.test(ct))
T("Accept" == xhr.getResponseHeader("Vary"));
var etag = xhr.getResponseHeader("etag");
@@ -287,7 +285,9 @@ couchTests.show_documents = function(debug) {
"Accept": 'text/html,application/atom+xml; q=0.9'
}
});
- T(xhr.getResponseHeader("Content-Type") == "text/html");
+ var ct = xhr.getResponseHeader("Content-Type");
+ T(/charset=utf-8/.test(ct))
+ T(/text\/html/.test(ct))
T(xhr.responseText == "Ha ha, you said \"plankton\".");
// now with xml
@@ -315,7 +315,9 @@ couchTests.show_documents = function(debug) {
"Accept": 'text/html,application/atom+xml; q=0.9'
}
});
- T(xhr.getResponseHeader("Content-Type") == "text/html");
+ var ct = xhr.getResponseHeader("Content-Type");
+ T(/charset=utf-8/.test(ct))
+ T(/text\/html/.test(ct))
T(xhr.responseText == "Ha ha, you said \"plankton\".");
// test inclusion of conflict state