Merge pull request #812 from clarkorz:fix/nest-remote-path
prepend slash for nested remoting path Close #812
This commit is contained in:
commit
543e90993c
|
@ -619,6 +619,10 @@ Model.nestRemoting = function(relationName, options, cb) {
|
||||||
acceptArgs = [];
|
acceptArgs = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (httpPath[0] !== '/') {
|
||||||
|
httpPath = '/' + httpPath;
|
||||||
|
}
|
||||||
|
|
||||||
// A method should return the method name to use, if it is to be
|
// A method should return the method name to use, if it is to be
|
||||||
// included as a nested method - a falsy return value will skip.
|
// included as a nested method - a falsy return value will skip.
|
||||||
var filter = cb || options.filterMethod || function(method, relation) {
|
var filter = cb || options.filterMethod || function(method, relation) {
|
||||||
|
|
|
@ -1293,6 +1293,18 @@ describe('relations - integration', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should have proper http.path for remoting', function() {
|
||||||
|
[app.models.Book, app.models.Image].forEach(function(Model) {
|
||||||
|
Model.sharedClass.methods().forEach(function(method) {
|
||||||
|
var http = Array.isArray(method.http) ? method.http : [method.http];
|
||||||
|
http.forEach(function(opt) {
|
||||||
|
// destroyAll has been shared but missing http property
|
||||||
|
if (opt.path === undefined) return;
|
||||||
|
expect(opt.path, method.stringName).to.match(/^\/.*/);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue