Skip to content

Commit 9a463cb

Browse files
committed
fix: solve issue with httpRequest search parameters
1 parent 45a0078 commit 9a463cb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "deepdetect-js",
3-
"version": "1.4.1",
3+
"version": "1.4.3",
44
"description": "DeepDetect JS client",
55
"license": "MIT",
66
"author": {

src/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,16 @@ DD.prototype._httpRequest = function _httpRequest(
191191
searchParams = null
192192
) {
193193
return new Promise(async (resolve, reject) => {
194-
const url = this.ddurl + apiMethod;
194+
let url = this.ddurl + apiMethod;
195195
const requestParams = { method: httpMethod };
196196

197197
if (jsonParams != null) {
198198
requestParams.body = JSON.stringify(jsonParams);
199199
} else if (searchParams != null) {
200-
requestParams.search = new URLSearchParams(searchParams);
200+
const urlParameters = Object.entries(searchParams)
201+
.map(e => e.join('='))
202+
.join('&');
203+
url += `?${urlParameters}`;
201204
}
202205

203206
fetch(url, requestParams).then(response => {

0 commit comments

Comments
 (0)