From b834461d54680d022d68725db68bbb9315768734 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Wed, 18 Aug 2010 14:44:07 +0000 Subject: Fix test suite for Chrome and Safari. couch.js patch by Robert Newson. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@986710 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/couch.js | 4 ++-- share/www/script/test/attachment_paths.js | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'share/www') diff --git a/share/www/script/couch.js b/share/www/script/couch.js index b7e0e513..7d189399 100644 --- a/share/www/script/couch.js +++ b/share/www/script/couch.js @@ -397,8 +397,8 @@ CouchDB.newXhr = function() { } CouchDB.request = function(method, uri, options) { - options = options || {}; - options.headers = options.headers || {}; + options = typeof(options) == 'object' ? options : {}; + options.headers = typeof(options.headers) == 'object' ? options.headers : {}; options.headers["Content-Type"] = options.headers["Content-Type"] || options.headers["content-type"] || "application/json"; options.headers["Accept"] = options.headers["Accept"] || options.headers["accept"] || "application/json"; var req = CouchDB.newXhr(); diff --git a/share/www/script/test/attachment_paths.js b/share/www/script/test/attachment_paths.js index a2a0f69c..bac30904 100644 --- a/share/www/script/test/attachment_paths.js +++ b/share/www/script/test/attachment_paths.js @@ -73,7 +73,10 @@ couchTests.attachment_paths = function(debug) { T(binAttDoc._attachments["foo/bar.txt"] !== undefined); T(binAttDoc._attachments["foo%2Fbaz.txt"] !== undefined); T(binAttDoc._attachments["foo/bar2.txt"] !== undefined); - T(binAttDoc._attachments["foo/bar2.txt"].content_type == "text/plain;charset=utf-8"); + TEquals("text/plain;charset=utf-8", // thank you Safari + binAttDoc._attachments["foo/bar2.txt"].content_type.toLowerCase(), + "correct content-type" + ); T(binAttDoc._attachments["foo/bar2.txt"].length == 30); //// now repeat the while thing with a design doc @@ -141,7 +144,10 @@ couchTests.attachment_paths = function(debug) { T(binAttDoc._attachments["foo/bar.txt"] !== undefined); T(binAttDoc._attachments["foo/bar2.txt"] !== undefined); - T(binAttDoc._attachments["foo/bar2.txt"].content_type == "text/plain;charset=utf-8"); + TEquals("text/plain;charset=utf-8", // thank you Safari + binAttDoc._attachments["foo/bar2.txt"].content_type.toLowerCase(), + "correct content-type" + ); T(binAttDoc._attachments["foo/bar2.txt"].length == 30); } }; -- cgit v1.2.3