Comparing version 1.0.2 to 1.0.3
@@ -9,3 +9,3 @@ { | ||
"homepage": "https://github.com/wprl/baucis", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "index.js", | ||
@@ -12,0 +12,0 @@ "scripts": { |
@@ -328,3 +328,3 @@ # baucis v1.0.2 | ||
} | ||
delete context.doc.password; | ||
context.doc.password = undefined; | ||
this.queue(context); | ||
@@ -331,0 +331,0 @@ })); |
@@ -110,2 +110,11 @@ // __Dependencies__ | ||
veggies.request(function (request, response, next) { | ||
if (request.query.deleteNutrients !== 'true') return next(); | ||
request.baucis.outgoing(function (context, callback) { | ||
context.doc.nutrients = undefined; | ||
callback(null, context); | ||
}); | ||
next(); | ||
}); | ||
// Test streaming in through custom handler | ||
@@ -181,3 +190,3 @@ veggies.request(function (request, response, next) { | ||
var minerals = mineralColors.map(function (color) { | ||
return new Mineral({ | ||
return new Mineral({ | ||
color: color, | ||
@@ -188,3 +197,3 @@ enables: fungus._id | ||
vegetables = vegetableNames.map(function (name) { // TODO leaked global | ||
return new Vegetable({ | ||
return new Vegetable({ | ||
name: name, | ||
@@ -191,0 +200,0 @@ nutrients: [ minerals[0]._id ] |
@@ -202,2 +202,18 @@ var expect = require('expect.js'); | ||
it('allows custom stream handlers to alter documents (delete)', function (done) { | ||
// should set all fields to a string | ||
var options = { | ||
url: 'http://localhost:8012/api/vegetables/', | ||
qs: { deleteNutrients: true }, | ||
json: true | ||
}; | ||
request.get(options, function (error, response, body) { | ||
if (error) return done(error); | ||
expect(response.statusCode).to.be(200); | ||
expect(body).to.have.property('length', 8); | ||
expect(body[0]).not.to.have.property('nutrients'); | ||
done(); | ||
}); | ||
}); | ||
it('should prevent mixing streaming and documents middleware (maybe)'); | ||
@@ -204,0 +220,0 @@ it('should allow streaming out into request.baucis.documents (maybe)');//, function (done) { |
357978
4385