Skip to content

Commit 957cd55

Browse files
authored
fix(path): fix path error when undefined
1 parent c18eed3 commit 957cd55

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function (app, configs = {}) {
3737

3838
methods.forEach((method) => {
3939
obj[method] = function Method(path) {
40-
const req = superagent[method](`${url}${this.base}${path}`);
40+
const req = superagent[method](`${url}${this.base}${path || ''}`);
4141
if (listen) req._server = listen; // eslint-disable-line
4242

4343
this.configs.forEach(config => Object.keys(config).forEach((key) => {
@@ -53,7 +53,7 @@ export default function (app, configs = {}) {
5353
obj.del = obj.delete;
5454

5555
obj.path = function Path(path) {
56-
return { ...this, base: `${this.base}${path}` };
56+
return { ...this, base: `${this.base}${path || ''}` };
5757
};
5858

5959
return obj;

0 commit comments

Comments
 (0)