Skip to content

Commit d9a2db6

Browse files
committed
fix: 🐛 query params parsing
1 parent e4050f5 commit d9a2db6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/core/src/http-adapter/http-adapter.browser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ export const getAdapter = () =>
4141
onRequestProgress,
4242
onSuccess,
4343
}) => {
44-
const { method, client, endpoint } = request;
45-
const fullUrl = `${client.url}${endpoint}`;
44+
const { method, client, endpoint, queryParams } = request;
45+
const queryString = queryParams ? stringifyQueryParams(queryParams) : "";
46+
const fullUrl = `${client.url}${endpoint}${queryString}`;
4647
const xhr = new XMLHttpRequest();
4748
xhr.timeout = defaultTimeout;
4849
const onAbort = () => xhr.abort();

packages/core/src/http-adapter/http-adapter.server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const getAdapter = () =>
4545
onRequestStart,
4646
onSuccess,
4747
}) => {
48-
const { method, client, endpoint } = request;
48+
const { method, client, endpoint, queryParams } = request;
4949
const { url } = client;
5050
const httpClient = client.url.includes("https://") ? https : http;
5151
const options = {
@@ -69,7 +69,8 @@ export const getAdapter = () =>
6969
options.headers["Content-Length"] = Buffer.byteLength(JSON.stringify(payload));
7070
}
7171

72-
const fullUrl = `${url}${endpoint}`;
72+
const queryString = queryParams ? stringifyQueryParams(queryParams) : "";
73+
const fullUrl = `${url}${endpoint}${queryString}`;
7374

7475
const unmountListener = createAbortListener({
7576
status: 0,

0 commit comments

Comments
 (0)