Comparing version 5.11.0 to 5.11.2
13
nano.js
@@ -1011,4 +1011,5 @@ /* minimal couch in node | ||
var stubs = attachments.reduce(function(memo, att) { | ||
memo[att.name] = { | ||
doc = _.extend({ _attachments: {} }, doc); | ||
attachments.forEach(function(att) { | ||
doc._attachments[att.name] = { | ||
follows: true, | ||
@@ -1018,9 +1019,7 @@ length: att.data.length, | ||
}; | ||
return memo; | ||
}, {}); | ||
}); | ||
var multipart = [ | ||
{ | ||
'content-type': 'application/json', | ||
body: JSON.stringify(_.extend({}, doc, { _attachments: stubs })) | ||
body: JSON.stringify(doc) | ||
} | ||
@@ -1290,3 +1289,3 @@ ]; | ||
port = path.port ? ':' + path.port : ''; | ||
db = cfg.db ? cfg.db : path_array[0]; | ||
db = cfg.db ? cfg.db : decodeURIComponent(path_array[0]); | ||
@@ -1293,0 +1292,0 @@ var format = { |
@@ -7,3 +7,3 @@ { | ||
"repository": "git://github.com/dscape/nano", | ||
"version": "5.11.0", | ||
"version": "5.11.2", | ||
"author": "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)", | ||
@@ -58,6 +58,6 @@ "contributors": [ | ||
"dependencies": { | ||
"request": "^2.40.0", | ||
"request": "~2.42.0", | ||
"follow": "~0.11.2", | ||
"errs": "^0.3.0", | ||
"underscore": "^1.7.0" | ||
"errs": "~0.3.0", | ||
"underscore": "~1.7.0" | ||
}, | ||
@@ -64,0 +64,0 @@ "devDependencies": { |
@@ -5,2 +5,4 @@ var specify = require('specify') | ||
, nano = helpers.nano | ||
, Nano = helpers.Nano | ||
, couch = helpers.couch | ||
, nock = helpers.nock | ||
@@ -23,2 +25,9 @@ ; | ||
specify("db_create:encoded_name_from_config", timeout, function (assert) { | ||
var config = Nano(helpers.couch + "/" + encodeURIComponent("with/slash")).config; | ||
Nano(config.url).db.create(config.db, function (err) { | ||
assert.equal(err, undefined, "Failed to create database"); | ||
}); | ||
}); | ||
specify("db_create:teardown", timeout, function (assert) { | ||
@@ -29,3 +38,6 @@ nano.db.destroy("db_create", function (err) { | ||
assert.equal(err, undefined, "Failed to destroy database"); | ||
assert.ok(mock.isDone(), "Some mocks didn't run"); | ||
nano.db.destroy("with/slash", function (err) { | ||
assert.equal(err, undefined, "Failed to destroy database"); | ||
assert.ok(mock.isDone(), "Some mocks didn't run"); | ||
}); | ||
}); | ||
@@ -35,2 +47,2 @@ }); | ||
specify.run(process.argv.slice(2)); | ||
specify.run(process.argv.slice(2)); |
@@ -12,2 +12,7 @@ [ | ||
} | ||
, { "method" : "put" | ||
, "path" : "/with%2Fslash" | ||
, "status" : 201 | ||
, "response" : "{ \"ok\": true }" | ||
} | ||
, { "method" : "delete" | ||
@@ -21,2 +26,6 @@ , "path" : "/db_create" | ||
} | ||
, { "method" : "delete" | ||
, "path" : "/with%2Fslash" | ||
, "response" : "{ \"ok\": true }" | ||
} | ||
] |
@@ -13,2 +13,22 @@ [ | ||
} | ||
, { "method" : "put" | ||
, "path" : "/multipart_insert/mydoc/one" | ||
, "body" : "Hello World!" | ||
, "status" : 201 | ||
, "response" : "{\"ok\": true, \"id\": \"one\", \"rev\": \"1-921bd51\" }" | ||
} | ||
, { "path" : "/multipart_insert/mydoc" | ||
, "status" : 200 | ||
, "response" : "{\"_id\": \"mydoc\", \"_rev\": \"1-921bd51\", \"_attachments\": { \"one\": { \"stub\": true } } }" | ||
} | ||
, { "method" : "put" | ||
, "path" : "/multipart_insert/mydoc" | ||
, "body" : "*" | ||
, "status" : 201 | ||
, "response" : "{\"ok\": true, \"id\": \"mydoc\", \"rev\": \"2-921bd51\"" | ||
} | ||
, { "path" : "/multipart_insert/mydoc" | ||
, "status" : 200 | ||
, "response" : "{\"_id\": \"mydoc\", \"_rev\": \"2-921bd51\", \"_attachments\": { \"one\": { \"stub\": true }, \"two\": { \"stub\": true } } }" | ||
} | ||
, { "method" : "delete" | ||
@@ -15,0 +35,0 @@ , "path" : "/multipart_insert" |
@@ -6,3 +6,2 @@ var specify = require('specify') | ||
, nock = helpers.nock | ||
, rev | ||
; | ||
@@ -27,3 +26,2 @@ | ||
db.multipart.insert({"foo": "baz"}, [att], "foobaz", function (error, foo) { | ||
rev = foo.rev; | ||
assert.equal(error, undefined, "Should have stored foo and attachment"); | ||
@@ -35,2 +33,21 @@ assert.equal(foo.ok, true, "Response should be ok"); | ||
specify("multipart_insert:test_with_present_attachment", timeout, function (assert) { | ||
var att = { | ||
name: 'two', | ||
data: 'Hello World!', | ||
content_type: 'text/plain' | ||
}; | ||
db.attachment.insert("mydoc", "one", "Hello World!", "text/plain", function () { | ||
db.get("mydoc", function(_, doc) { | ||
db.multipart.insert(doc, [att], "mydoc", function () { | ||
db.get("mydoc", function(error, two) { | ||
assert.equal(error, undefined, "Should get the doc"); | ||
assert.equal(Object.keys(two._attachments).length, 2, "Both attachments should be present"); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
specify("multipart_insert:teardown", timeout, function (assert) { | ||
@@ -37,0 +54,0 @@ nano.db.destroy("multipart_insert", function (err) { |
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
194059
4533
+ Addedasn1@0.1.11(transitive)
+ Addedassert-plus@0.1.5(transitive)
+ Addedasync@0.9.2(transitive)
+ Addedaws-sign2@0.5.0(transitive)
+ Addedbl@0.9.5(transitive)
+ Addedboom@0.4.2(transitive)
+ Addedcaseless@0.6.0(transitive)
+ Addedcombined-stream@0.0.7(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcryptiles@0.2.2(transitive)
+ Addedctype@0.5.3(transitive)
+ Addeddelayed-stream@0.0.5(transitive)
+ Addedforever-agent@0.5.2(transitive)
+ Addedform-data@0.1.4(transitive)
+ Addedhawk@1.1.1(transitive)
+ Addedhoek@0.9.1(transitive)
+ Addedhttp-signature@0.10.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedmime@1.2.11(transitive)
+ Addedmime-types@1.0.2(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addedoauth-sign@0.4.0(transitive)
+ Addedqs@1.2.2(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedrequest@2.42.0(transitive)
+ Addedsntp@0.2.4(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedstringstream@0.0.6(transitive)
+ Addedtunnel-agent@0.4.3(transitive)
+ Addedunderscore@1.7.0(transitive)
- Removedunderscore@1.13.7(transitive)
Updatederrs@~0.3.0
Updatedrequest@~2.42.0
Updatedunderscore@~1.7.0