Permalink
Browse files

Server bound directly to a client will use proper serialization

  • Loading branch information...
tedeh committed Dec 30, 2012
1 parent d61f945 commit 04981515de8a94e031fe327048c29572ac91ffe0
Showing with 7 additions and 2 deletions.
  1. +6 −1 lib/client.js
  2. +1 −1 test/support/client-server.js
View
@@ -130,7 +130,12 @@ Client.prototype.request = function(method, params, id, callback) {
* @api private
*/
Client.prototype._request = function(request, callback) {
- this.server.call(request, function(error, success) {
+
+ // serializes the request as a JSON string so that we get a copy and can run the replacer
+ try { var body = JSON.stringify(request, this.options.replacer); }
+ catch(err) { return callback(err); }
+
+ this.server.call(body, function(error, success) {
var response = error || success;
callback(null, response);
});
@@ -84,7 +84,7 @@ exports.clientReviveReplace = function(client) {
should.not.exist(err);
should.not.exist(error);
should.exist(result);
- result.should.be.instanceof(Counter);
+ result.should.be.instanceof(Counter).and.not.equal(instance, 'Not the same object');
result.count.should.equal(a + b);
done();
});

0 comments on commit 0498151

Please sign in to comment.