Skip to content

Commit a1e6122

Browse files
committed
Strip trailing slashes from pathname
1 parent 1ce4aab commit a1e6122

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/.vuepress/components/UrlHelper.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,17 @@
211211
return fixtures;
212212
}
213213
214+
let pathname = url.pathname.replace(/\/$/, '');
214215
let searchParams = Array.from(url.searchParams.entries());
216+
215217
if (searchParams.length) {
216218
const search = this.formatSearchParams(searchParams);
217-
fixtures.push(`${url.hostname}${url.pathname}.${search}.${this.method}.mock`);
218-
fixtures.push(`${url.hostname}${url.pathname}.${search}.mock`);
219+
fixtures.push(`${url.hostname}${pathname}.${search}.${this.method}.mock`);
220+
fixtures.push(`${url.hostname}${pathname}.${search}.mock`);
219221
}
220222
221-
fixtures.push(`${url.hostname}${url.pathname}.${this.method}.mock`);
222-
fixtures.push(`${url.hostname}${url.pathname}.mock`);
223+
fixtures.push(`${url.hostname}${pathname}.${this.method}.mock`);
224+
fixtures.push(`${url.hostname}${pathname}.mock`);
223225
224226
return fixtures;
225227
}

0 commit comments

Comments
 (0)