Skip to content

Commit

Permalink
Use non-compressed Content-Type in attachments test suites
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dch committed Dec 14, 2012
1 parent 6c3c7b8 commit c0d20c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions share/www/script/test/attachment_names.js
Expand Up @@ -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="
}
}
Expand All @@ -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",
Expand Down
10 changes: 7 additions & 3 deletions share/www/script/test/attachments.js
Expand Up @@ -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="
}
}
Expand All @@ -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 = {
Expand Down

0 comments on commit c0d20c1

Please sign in to comment.