Skip to content

Commit 70275e1

Browse files
authored
Merge pull request #185 from particle-iot/fix/omit-empty-querystring
Don't add an empty query string to the URL
2 parents 25e5c4e + 4c5f691 commit 70275e1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Agent.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,10 @@ class Agent {
255255
}
256256
if (query) {
257257
const queryParams = qs.stringify(query);
258-
const hasParams = actualUri.includes('?');
259-
actualUri = `${actualUri}${hasParams ? '&' : '?'}${queryParams}`;
258+
if (queryParams) {
259+
const hasParams = actualUri.includes('?');
260+
actualUri = `${actualUri}${hasParams ? '&' : '?'}${queryParams}`;
261+
}
260262
}
261263

262264
const userAgentHeader = { 'User-Agent': `${packageJson.name}/${packageJson.version} (${packageJson.repository.url})` };

0 commit comments

Comments
 (0)