Comparing version 4.7.1 to 5.7.1
12
nano.js
@@ -224,3 +224,3 @@ /* minimal couch in node | ||
if(opts.body) { | ||
if (Buffer.isBuffer(opts.body)) { | ||
if (Buffer.isBuffer(opts.body) || opts.dont_stringify) { | ||
req.body = opts.body; // raw data | ||
@@ -296,3 +296,7 @@ } | ||
try { parsed = JSON.parse(b); } catch (err) { parsed = b; } | ||
if (opts.dont_parse) { | ||
parsed = b; | ||
} else { | ||
try { parsed = JSON.parse(b); } catch (err) { parsed = b; } | ||
} | ||
@@ -1040,3 +1044,3 @@ if (status_code >= 200 && status_code < 400) { | ||
, content_type: content_type, doc: doc_name, params: params | ||
, body: att}, callback); | ||
, body: att, dont_stringify: true}, callback); | ||
} | ||
@@ -1059,3 +1063,3 @@ | ||
return relax({ db: db_name, att: att_name, method: 'GET', doc: doc_name | ||
, params: params, encoding: null},callback); | ||
, params: params, encoding: null, dont_parse: true},callback); | ||
} | ||
@@ -1062,0 +1066,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"repository": "git://github.com/dscape/nano", | ||
"version": "4.7.1", | ||
"version": "5.7.1", | ||
"author": "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)", | ||
@@ -9,0 +9,0 @@ "contributors": [ |
@@ -19,4 +19,4 @@ var specify = require('specify') | ||
specify("att_get:test", timeout, function (assert) { | ||
db.attachment.insert("new", "att", "Hello", "text/plain", | ||
specify("att_get:test_string", timeout, function (assert) { | ||
db.attachment.insert("new_string", "att", "Hello", "text/plain", | ||
function(error, hello) { | ||
@@ -26,6 +26,6 @@ assert.equal(error, undefined, "Should store hello"); | ||
assert.ok(hello.rev, "Should have a revision number"); | ||
db.attachment.get("new", "att", | ||
db.attachment.get("new_string", "att", | ||
function (error, helloWorld) { | ||
assert.equal(error, undefined, "Should get the hello"); | ||
assert.equal("Hello", helloWorld, "hello is reflexive"); | ||
assert.equal("Hello", helloWorld, "string is reflexive"); | ||
}); | ||
@@ -35,2 +35,16 @@ }); | ||
specify("att_get:test_binary", timeout, function (assert) { | ||
db.attachment.insert("new_binary", "att", new Buffer("123"), "text/plain", | ||
function(error, hello) { | ||
assert.equal(error, undefined, "Should store 123"); | ||
assert.equal(hello.ok, true, "Response should be ok"); | ||
assert.ok(hello.rev, "Should have a revision number"); | ||
db.attachment.get("new_binary", "att", | ||
function (error, binaryData) { | ||
assert.equal(error, undefined, "Should get the binary data"); | ||
assert.equal("123", binaryData, "binary data is reflexive"); | ||
}); | ||
}); | ||
}); | ||
specify("att_get:teardown", timeout, function (assert) { | ||
@@ -37,0 +51,0 @@ nano.db.destroy("att_get", function (err) { |
@@ -9,3 +9,3 @@ [ | ||
, "path" : "/att_destroy/new/att" | ||
, "body" : "\"Hello World!\"" | ||
, "body" : "Hello World!" | ||
, "status" : 201 | ||
@@ -21,3 +21,3 @@ , "response" : "{\"ok\": true, \"id\": \"new\", \"rev\": \"1-921bd51\" }" | ||
, "path" : "/att_destroy/new2/att2" | ||
, "body" : "\"Hello World!\"" | ||
, "body" : "Hello World!" | ||
, "status" : 201 | ||
@@ -24,0 +24,0 @@ , "response" : "{\"ok\": true, \"id\": \"new\", \"rev\": \"1-921bd51\" }" |
@@ -8,11 +8,21 @@ [ | ||
, { "method" : "put" | ||
, "path" : "/att_get/new/att" | ||
, "body" : "\"Hello\"" | ||
, "path" : "/att_get/new_string/att" | ||
, "body" : "Hello" | ||
, "status" : 201 | ||
, "response" : "{\"ok\":true,\"id\":\"new\",\"rev\":\"1-5142a2\"}" | ||
, "response" : "{\"ok\":true,\"id\":\"new_string\",\"rev\":\"1-5142a2\"}" | ||
} | ||
, { "path" : "/att_get/new/att" | ||
, { "path" : "/att_get/new_string/att" | ||
, "status" : 200 | ||
, "response" : "\"Hello\"" | ||
, "response" : "Hello" | ||
} | ||
, { "method" : "put" | ||
, "path" : "/att_get/new_binary/att" | ||
, "base64" : "MTIz" | ||
, "status" : 201 | ||
, "response" : "{\"ok\":true,\"id\":\"new_binary\",\"rev\":\"1-5142ff\"}" | ||
} | ||
, { "path" : "/att_get/new_binary/att" | ||
, "status" : 200 | ||
, "buffer" : "MTIz" | ||
} | ||
, { "method" : "delete" | ||
@@ -19,0 +29,0 @@ , "path" : "/att_get" |
@@ -9,3 +9,3 @@ [ | ||
, "path" : "/att_insert/new/att" | ||
, "body" : "\"Hello World!\"" | ||
, "body" : "Hello World!" | ||
, "status" : 201 | ||
@@ -12,0 +12,0 @@ , "response" : "{\"ok\": true, \"id\": \"new\", \"rev\": \"1-921bd51\" }" |
@@ -9,3 +9,3 @@ [ | ||
, "path" : "/att_update/new/att" | ||
, "body" : "\"Hello\"" | ||
, "body" : "Hello" | ||
, "status" : 201 | ||
@@ -12,0 +12,0 @@ , "response" : "{\"ok\":true,\"id\":\"new\",\"rev\":\"1-5142a2\"}" |
@@ -9,3 +9,3 @@ [ | ||
, "path" : "/shared_headers/new/att" | ||
, "body" : "\"Hello\"" | ||
, "body" : "Hello" | ||
, "status" : 201 | ||
@@ -12,0 +12,0 @@ , "response" : "{\"ok\":true,\"id\":\"new\",\"rev\":\"1-5142a2\"}" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
185567
4315