Skip to content

Instantly share code, notes, and snippets.

@flazz
Created December 24, 2008 21:59
Show Gist options
  • Save flazz/39792 to your computer and use it in GitHub Desktop.
Save flazz/39792 to your computer and use it in GitHub Desktop.
function (debug)
{
var db = new CouchDB("test_suite_db");
db.deleteDb();
db.createDb();
if (debug)
;
var binAttDoc = { "_id": "bin_doc", "_attachments": { "foo.txt": { "content_type": "text/plain", "data": "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ=" } } };
T(db.save(binAttDoc).ok);
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");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment