Merge branch 'master' of github.com:deployd/deployd

Conflicts:
	HISTORY.md
This commit is contained in:
Dallon Feldner
2012-12-04 17:13:05 -07:00
8 changed files with 54 additions and 6 deletions

View File

@@ -2,10 +2,13 @@
## 0.6.10
- Fixed bug where changing a property type from "number" to "string" made existing properties uneditable.
- Fixed bug where `changed()` was returning true for values that had not changed.
- Fixed certain error's returned as HTML rather than JSON.
## 0.6.9
- Fixed bug where `internal-client` was not accessible from modules
- Fixed bug where `internal-client` was not accessible from modules
- Fixed restarts caused by 404s of unexpected http verbs
## 0.6.8

View File

@@ -31,8 +31,11 @@ function sendRequest(url,options) {
req.open(method,url,true);
req.withCredentials = true;
// req.setRequestHeader('User-Agent','XMLHTTP/1.0');
if (data)
req.setRequestHeader('Content-type', options.contentType || 'application/json');
if (data) {
req.setRequestHeader('Content-Type', options.contentType || 'application/json');
}
req.setRequestHeader('Accept', 'application/json');
if (typeof sendRequest.headers === 'object') {
for (var k in sendRequest.headers) {
if (sendRequest.headers.hasOwnProperty(k)) {

View File

@@ -440,7 +440,13 @@ Collection.prototype.save = function (ctx, fn) {
};
domain.changed = function (property) {
if(domain.data.hasOwnProperty(property)) return true;
if(domain.data.hasOwnProperty(property)) {
if(domain.previous && domain.previous[property] === domain.data[property]) {
return false;
}
return true;
}
return false;
};
@@ -466,7 +472,8 @@ Collection.prototype.save = function (ctx, fn) {
prev[key] = obj[key];
obj[key] = item[key];
});
prev.id = id;
item = obj;
domain['this'] = item;
domain.data = item;

View File

@@ -3,6 +3,7 @@ var db = require('./db')
, escapeRegExp = /[\-\[\]{}()+?.,\\\^$|#\s]/g
, debug = require('debug')('router')
, doh = require('doh')
, error404 = doh.createResponder()
, async = require('async');
/**
@@ -83,7 +84,7 @@ Router.prototype.route = function (req, res) {
} else {
debug('404 %s', req.url);
res.statusCode = 404;
res.domain.emit('error', new Error('Resource not found'));
error404({message: 'resource not found'}, req, res);
}
});
});

View File

@@ -12,6 +12,7 @@
<script>mocha.setup('bdd')</script>
<!-- -- tests -- -->
<script src="test/util.test.js"></script>
<script src="test/misc.test.js"></script>
<script src="test/collection.test.js"></script>
<script src="test/user-collection.test.js"></script>
</head>

View File

@@ -871,6 +871,17 @@ describe('Collection', function() {
});
});
it('should not return true when a value has not changed', function(done) {
dpd.changed.post({name: '$NO_CHANGE'}, function (c) {
dpd.changed.put(c.id, {name: '$NO_CHANGE'}, function (c) {
if(c.name != '$NO_CHANGE') {
throw new Error('incorrect name change');
}
done();
});
});
});
afterEach(function (done) {
this.timeout(10000);
cleanCollection(dpd.changed, done);

View File

@@ -0,0 +1,17 @@
describe('404s', function(){
it('should not prevent a server from responding', function(done) {
this.timeout(5000);
var tests = 50;
var remaining = tests;
while(tests--) {
dpd('/').post({foo: 'bar'}, function (res, err) {
remaining--;
if(!remaining) {
done();
}
});
}
});
});

View File

@@ -0,0 +1,5 @@
if(this.name === '$NO_CHANGE') {
if(changed('name')) {
this.name = 'saw name change';
}
}