Permalink
Browse files

fix(rest): don't replace //, avoid adding them instead

  • Loading branch information...
doktordirk committed Aug 3, 2016
1 parent afeacc5 commit 2ce671a2693d3eccb42ad95c16c5cbdde84a54aa
Showing with 3 additions and 5 deletions.
  1. +3 −5 src/rest.js
@@ -139,11 +139,9 @@ function getRequestPath(resource, criteria) {
if (typeof criteria === 'object' && criteria !== null) {
resource += `?${buildQueryString(criteria)}`;
} else if (criteria) {
if (resource.slice(-1) === '/') {
criteria += '/';
}
resource += `/${criteria}`;
let hasSlash = resource.slice(-1) === '/';
resource += `${hasSlash ? '' : '/'}${criteria}${hasSlash ? '/' : ''}`;
}

return resource.replace(/\/\//g, '/');
return resource;
}

0 comments on commit 2ce671a

Please sign in to comment.