diff --git a/src/index.js b/src/index.js index 59c6953..66ab0e9 100644 --- a/src/index.js +++ b/src/index.js @@ -97,14 +97,18 @@ class DSHttpAdapter { getPath(method, resourceConfig, id, options) { let _this = this; options = options || {}; - let args = [ - options.basePath || _this.defaults.basePath || resourceConfig.basePath, - this.getEndpoint(resourceConfig, (isString(id) || isNumber(id) || method === 'create') ? id : null, options) - ]; - if (method === 'find' || method === 'update' || method === 'destroy') { - args.push(id); + if (isString(options.urlPath)) { + return makePath.apply(DSUtils, [options.basePath || _this.defaults.basePath || resourceConfig.basePath, options.urlPath.split('/')]); + } else { + let args = [ + options.basePath || _this.defaults.basePath || resourceConfig.basePath, + this.getEndpoint(resourceConfig, (isString(id) || isNumber(id) || method === 'create') ? id : null, options) + ]; + if (method === 'find' || method === 'update' || method === 'destroy') { + args.push(id); + } + return makePath.apply(DSUtils, args); } - return makePath.apply(DSUtils, args); } HTTP(config) { @@ -289,4 +293,3 @@ class DSHttpAdapter { } module.exports = DSHttpAdapter; -