Skip to content

Commit 1b12b0d

Browse files
authored
prevent urls ending with empty "?" when no params present
1 parent 33b5ffc commit 1b12b0d

File tree

1 file changed

+6
-3
lines changed
  • packages/node_modules/pouchdb-adapter-http/src

1 file changed

+6
-3
lines changed

packages/node_modules/pouchdb-adapter-http/src/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,12 @@ function genUrl(opts, path) {
134134
}
135135

136136
function paramsToStr(params) {
137-
return '?' + Object.keys(params).map(function (k) {
138-
return k + '=' + encodeURIComponent(params[k]);
139-
}).join('&');
137+
const paramKeys = Object.keys(params);
138+
if (paramKeys.length === 0) {
139+
return '';
140+
}
141+
142+
return '?' + paramKeys.map(key => key + '=' + encodeURIComponent(params[key])).join('&');
140143
}
141144

142145
function shouldCacheBust(opts) {

0 commit comments

Comments
 (0)