diff --git a/CHANGELOG.md b/CHANGELOG.md index 568f948d8..e98c7cf0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Not released +- Fix overwrite default client in SQL post request [#603](https://github.com/CartoDB/carto-react/pull/603) + ## 2.0 ### 2.0.0-beta.1 (2023-02-14) diff --git a/packages/react-api/src/api/SQL.js b/packages/react-api/src/api/SQL.js index 1ae373ede..40c9b3cd1 100644 --- a/packages/react-api/src/api/SQL.js +++ b/packages/react-api/src/api/SQL.js @@ -74,11 +74,12 @@ function createRequest({ queryParameters = [] }) { const { abortController, ...otherOptions } = opts; + const client = opts.client || CLIENT_ID; const { apiVersion = API_VERSIONS.V2 } = credentials; const rawParams = { - client: CLIENT_ID, + client, q: query?.trim(), ...otherOptions }; @@ -118,8 +119,7 @@ function createRequest({ } // Post request - const urlParamsForPost = - apiVersion === API_VERSIONS.V3 ? [`client=${CLIENT_ID}`] : null; + const urlParamsForPost = apiVersion === API_VERSIONS.V3 ? [`client=${client}`] : null; const payload = { ...rawParams,