You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/05/22 00:01:13 UTC

svn commit: r1125829 - in /couchdb/branches/1.0.x: share/www/script/test/attachments_multipart.js src/couchdb/couch_httpd_db.erl

Author: fdmanana
Date: Sat May 21 22:01:13 2011
New Revision: 1125829

URL: http://svn.apache.org/viewvc?rev=1125829&view=rev
Log:
Merged revision 1125828 from trunk

    Add missing option to multipart/related GETs

    This is necessary as the client needs to be able to know if           
    attachments are encoded or not.


Modified:
    couchdb/branches/1.0.x/share/www/script/test/attachments_multipart.js
    couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl

Modified: couchdb/branches/1.0.x/share/www/script/test/attachments_multipart.js
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/share/www/script/test/attachments_multipart.js?rev=1125829&r1=1125828&r2=1125829&view=diff
==============================================================================
--- couchdb/branches/1.0.x/share/www/script/test/attachments_multipart.js (original)
+++ couchdb/branches/1.0.x/share/www/script/test/attachments_multipart.js Sat May 21 22:01:13 2011
@@ -39,7 +39,7 @@ couchTests.attachments_multipart= functi
             },
           "baz.txt": {
             "follows":true,
-            "content_type":"application/test",
+            "content_type":"text/plain",
             "length":19
             }
           }
@@ -78,12 +78,15 @@ couchTests.attachments_multipart= functi
   
   // now edit an attachment
   
-  var doc = db.open("multipart");
+  var doc = db.open("multipart", {att_encoding_info: true});
   var firstrev = doc._rev;
   
   T(doc._attachments["foo.txt"].stub == true);
   T(doc._attachments["bar.txt"].stub == true);
   T(doc._attachments["baz.txt"].stub == true);
+  TEquals("undefined", typeof doc._attachments["foo.txt"].encoding);
+  TEquals("undefined", typeof doc._attachments["bar.txt"].encoding);
+  TEquals("gzip", doc._attachments["baz.txt"].encoding);
   
   //lets change attachment bar
   delete doc._attachments["bar.txt"].stub; // remove stub member (or could set to false)

Modified: couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl?rev=1125829&r1=1125828&r2=1125829&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/branches/1.0.x/src/couchdb/couch_httpd_db.erl Sat May 21 22:01:13 2011
@@ -761,7 +761,7 @@ send_doc_efficiently(Req, #doc{atts=Atts
         true ->
             Boundary = couch_uuids:random(),
             JsonBytes = ?JSON_ENCODE(couch_doc:to_json_obj(Doc, 
-                    [attachments, follows|Options])),
+                    [attachments, follows, att_encoding_info | Options])),
             {ContentType, Len} = couch_doc:len_doc_to_multi_part_stream(
                     Boundary,JsonBytes, Atts, true),
             CType = {<<"Content-Type">>, ContentType},