summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Cottlehuber <dch@apache.org>2012-01-15 23:38:13 +0100
committerDave Cottlehuber <dch@apache.org>2012-12-13 16:20:26 +0100
commit7941046aed824de89fa1cafbb4b063095fe192f1 (patch)
tree264fae098e54e6bfe316f1fb46ba9412cd0af87b
parenta8aff9f91790b0dae347b10b7c11b21f34faa0b2 (diff)
downloadcouchdb-7941046aed824de89fa1cafbb4b063095fe192f1.tar.gz
Use non-compressed Content-Type in attachments test suites
MD5-Digests of attachments are calculated on the compressed data if the attachment MIME type is compressible, as defined in default.ini [attachments] compressible_types Windows uses a different gzip implementation, and therefore generates different MD5-Digests than other platforms. Using binary Content-Type resolves this.
-rw-r--r--share/www/script/test/attachment_names.js6
-rw-r--r--share/www/script/test/attachments.js10
2 files changed, 10 insertions, 6 deletions
diff --git a/share/www/script/test/attachment_names.js b/share/www/script/test/attachment_names.js
index fb5f18f5c..c9a5fcce3 100644
--- a/share/www/script/test/attachment_names.js
+++ b/share/www/script/test/attachment_names.js
@@ -20,7 +20,7 @@ couchTests.attachment_names = function(debug) {
_id: "good_doc",
_attachments: {
"Колян.txt": {
- content_type:"text/plain",
+ content_type:"application/octet-stream",
data: "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ="
}
}
@@ -31,8 +31,8 @@ couchTests.attachment_names = function(debug) {
var xhr = CouchDB.request("GET", "/test_suite_db/good_doc/Колян.txt");
T(xhr.responseText == "This is a base64 encoded text");
- T(xhr.getResponseHeader("Content-Type") == "text/plain");
- TEquals("\"qUUYqS41RhwF0TrCsTAxFg==\"", xhr.getResponseHeader("Etag"));
+ T(xhr.getResponseHeader("Content-Type") == "application/octet-stream");
+ TEquals("\"aEI7pOYCRBLTRQvvqYrrJQ==\"", xhr.getResponseHeader("Etag"));
var binAttDoc = {
_id: "bin_doc",
diff --git a/share/www/script/test/attachments.js b/share/www/script/test/attachments.js
index a409f82de..db4524a92 100644
--- a/share/www/script/test/attachments.js
+++ b/share/www/script/test/attachments.js
@@ -16,11 +16,15 @@ couchTests.attachments= function(debug) {
db.createDb();
if (debug) debugger;
+
+ // MD5 Digests of compressible attachments and therefore Etags
+ // will vary depending on platform gzip implementation.
+ // These MIME types are defined in [attachments] compressible_types
var binAttDoc = {
_id: "bin_doc",
_attachments:{
"foo.txt": {
- content_type:"text/plain",
+ content_type:"application/octet-stream",
data: "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ="
}
}
@@ -31,8 +35,8 @@ couchTests.attachments= function(debug) {
var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc/foo.txt");
T(xhr.responseText == "This is a base64 encoded text");
- T(xhr.getResponseHeader("Content-Type") == "text/plain");
- TEquals("\"qUUYqS41RhwF0TrCsTAxFg==\"", xhr.getResponseHeader("Etag"));
+ T(xhr.getResponseHeader("Content-Type") == "application/octet-stream");
+ TEquals("\"aEI7pOYCRBLTRQvvqYrrJQ==\"", xhr.getResponseHeader("Etag"));
// empty attachment
var binAttDoc2 = {