couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r957976 - in /couchdb/branches/0.11.x/share/www/script: couch.js test/content_negotiation.js test/list_views.js
Date Fri, 25 Jun 2010 14:22:31 GMT
Author: jan
Date: Fri Jun 25 14:22:31 2010
New Revision: 957976

URL: http://svn.apache.org/viewvc?rev=957976&view=rev
Log:
Merge r957799 from trunk:

use proper Accept headers in the test suite

Modified:
    couchdb/branches/0.11.x/share/www/script/couch.js
    couchdb/branches/0.11.x/share/www/script/test/content_negotiation.js
    couchdb/branches/0.11.x/share/www/script/test/list_views.js

Modified: couchdb/branches/0.11.x/share/www/script/couch.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/script/couch.js?rev=957976&r1=957975&r2=957976&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/script/couch.js [utf-8] (original)
+++ couchdb/branches/0.11.x/share/www/script/couch.js [utf-8] Fri Jun 25 14:22:31 2010
@@ -399,7 +399,8 @@ CouchDB.newXhr = function() {
 CouchDB.request = function(method, uri, options) {
   options = options || {};
   options.headers = options.headers || {};
-  options.headers["Content-Type"] = options.headers["Content-Type"] || "application/json";
+  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();
   if(uri.substr(0, "http://".length) != "http://") {
     uri = CouchDB.urlPrefix + uri

Modified: couchdb/branches/0.11.x/share/www/script/test/content_negotiation.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/script/test/content_negotiation.js?rev=957976&r1=957975&r2=957976&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/script/test/content_negotiation.js (original)
+++ couchdb/branches/0.11.x/share/www/script/test/content_negotiation.js Fri Jun 25 14:22:31
2010
@@ -17,11 +17,14 @@ couchTests.content_negotiation = functio
   if (debug) debugger;
   var xhr;
 
-  xhr = CouchDB.request("GET", "/test_suite_db/");
-  TEquals("text/plain;charset=utf-8", xhr.getResponseHeader("Content-Type"));
+  // with no accept header
+  var req = CouchDB.newXhr();
+  req.open("GET", "/test_suite_db/", false);
+  req.send("");
+  TEquals("text/plain;charset=utf-8", req.getResponseHeader("Content-Type"));
 
   // make sure JSON responses end in a newline
-  var text = xhr.responseText;
+  var text = req.responseText;
   TEquals("\n", text[text.length-1]);
 
   xhr = CouchDB.request("GET", "/test_suite_db/", {

Modified: couchdb/branches/0.11.x/share/www/script/test/list_views.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/script/test/list_views.js?rev=957976&r1=957975&r2=957976&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/script/test/list_views.js (original)
+++ couchdb/branches/0.11.x/share/www/script/test/list_views.js Fri Jun 25 14:22:31 2010
@@ -343,13 +343,21 @@ couchTests.list_views = function(debug) 
   // T(xhr.getResponseHeader("Content-Type") == "text/plain");
   T(xhr.responseText.match(/^head 0 1 2 tail$/) && "basic stop");
 
-  xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/stopIter2/basicView");
+  xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/stopIter2/basicView",
{
+    headers : {
+      "Accept" : "text/html"
+    }
+  });
   T(xhr.responseText.match(/^head 0 1 2 tail$/) && "stop 2");
 
   // aborting iteration with reduce
   var xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/stopIter/withReduce?group=true");
   T(xhr.responseText.match(/^head 0 1 2 tail$/) && "reduce stop");
-  xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/stopIter2/withReduce?group=true");
+  xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/stopIter2/withReduce?group=true",
{
+    headers : {
+      "Accept" : "text/html"
+    }
+  });
   T(xhr.responseText.match(/^head 0 1 2 tail$/) && "reduce stop 2");
 
   // with accept headers for HTML



Mime
View raw message