summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2009-11-13 20:38:45 +0000
committerDamien F. Katz <damien@apache.org>2009-11-13 20:38:45 +0000
commit627481ee0ade53d0ceed2e29cbb4e312ecbe3340 (patch)
tree7ebc9d3b490b670103fca359e47c6aff284922ef /share
parentdbf062b847922c8bffa43915324d8f75646a3dce (diff)
Initial check-in of APIs for multiple/related supported and incremental replication of only changed attachments. Needs more far more testing and to be hooked up the replicator.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@835981 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r--share/www/script/test/attachments.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/share/www/script/test/attachments.js b/share/www/script/test/attachments.js
index 36f5a5ad..1d695a3c 100644
--- a/share/www/script/test/attachments.js
+++ b/share/www/script/test/attachments.js
@@ -237,6 +237,60 @@ couchTests.attachments= function(debug) {
headers:{"Content-Type":"text/plain;charset=utf-8"}
});
TEquals(201, xhr.status, "should send 201 Accepted");
+
+ // try mime multipart
+
+ xhr = CouchDB.request("PUT", "/test_suite_db/multipart", {
+ headers: {"Content-Type": "multipart/related;boundary=\"abc123\""},
+ body:
+ "--abc123\r\n" +
+ "content-type: application/json\r\n" +
+ "\r\n" +
+ JSON.stringify({
+ "body":"This is a body.",
+ "_attachments":{
+ "foo.txt": {
+ "follows":true,
+ "content_type":"text/plain",
+ "length":21
+ },
+ "bar.txt": {
+ "follows":true,
+ "content_type":"text/plain",
+ "length":20
+ },
+ "baz.txt": {
+ "follows":true,
+ "content_type":"text/plain",
+ "length":19
+ }
+ }
+ }) +
+ "\r\n--abc123\r\n" +
+ "\r\n" +
+ "this is 21 chars long" +
+ "\r\n--abc123\r\n" +
+ "\r\n" +
+ "this is 20 chars lon" +
+ "\r\n--abc123\r\n" +
+ "\r\n" +
+ "this is 19 chars lo" +
+ "\r\n--abc123--"
+ });
+
+ TEquals(201, xhr.status, "should send 201 Accepted");
+
+ xhr = CouchDB.request("GET", "/test_suite_db/multipart/foo.txt");
+
+ T(xhr.responseText == "this is 21 chars long");
+
+ xhr = CouchDB.request("GET", "/test_suite_db/multipart/bar.txt");
+
+ T(xhr.responseText == "this is 20 chars lon");
+
+ xhr = CouchDB.request("GET", "/test_suite_db/multipart/baz.txt");
+
+ T(xhr.responseText == "this is 19 chars lo");
// implicit doc creation allows creating docs with a reserved id. COUCHDB-565
var xhr = CouchDB.request("PUT", "/test_suite_db/_nonexistant/attachment.txt", {