do not mutate incoming params object
This commit is contained in:
@ -118,7 +118,7 @@ var castType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function resolveUrl(url, params) {
|
function resolveUrl(url, params) {
|
||||||
var vars = {}, i, key;
|
var vars = {}, i, key, params = _.clone(params);
|
||||||
|
|
||||||
if (url.req) {
|
if (url.req) {
|
||||||
// url has required params
|
// url has required params
|
||||||
|
|||||||
@ -813,6 +813,16 @@ describe('Client Action runner', function () {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not modify the incoming params object', function () {
|
||||||
|
var action = makeClientAction({ url: { req: { index: { type: 'string' } } } }),
|
||||||
|
params = { index: 'index' },
|
||||||
|
before = JSON.stringify(params);
|
||||||
|
|
||||||
|
action(params);
|
||||||
|
|
||||||
|
expect(JSON.stringify(params)).to.equal(before);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user