Skip to content

Commit 31a4129

Browse files
committed
Merge pull request #25 from internalfx/master
Allow urlPath override for httpAdapter
2 parents 4c4427f + e1c93b1 commit 31a4129

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Diff for: src/index.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,18 @@ class DSHttpAdapter {
9999
getPath(method, resourceConfig, id, options) {
100100
let _this = this;
101101
options = options || {};
102-
let args = [
103-
options.basePath || _this.defaults.basePath || resourceConfig.basePath,
104-
this.getEndpoint(resourceConfig, (isString(id) || isNumber(id) || method === 'create') ? id : null, options)
105-
];
106-
if (method === 'find' || method === 'update' || method === 'destroy') {
107-
args.push(id);
102+
if (isString(options.urlPath)) {
103+
return makePath.apply(DSUtils, [options.basePath || _this.defaults.basePath || resourceConfig.basePath, options.urlPath.split('/')]);
104+
} else {
105+
let args = [
106+
options.basePath || _this.defaults.basePath || resourceConfig.basePath,
107+
this.getEndpoint(resourceConfig, (isString(id) || isNumber(id) || method === 'create') ? id : null, options)
108+
];
109+
if (method === 'find' || method === 'update' || method === 'destroy') {
110+
args.push(id);
111+
}
112+
return makePath.apply(DSUtils, args);
108113
}
109-
return makePath.apply(DSUtils, args);
110114
}
111115

112116
HTTP(config) {

0 commit comments

Comments
 (0)