Skip to content

Commit

Permalink
SNOW-502598: Parse data back into JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Oct 23, 2023
1 parent 0a7b7c8 commit 8d8bd87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/connection/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ function Connection(context)
// Get the response containing the query status
const response = await services.sf.requestAsync(options);

return JSON.parse(response['data']);
return response['body'];
}

/**
Expand Down
9 changes: 8 additions & 1 deletion lib/http/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ HttpClient.prototype.requestAsync = async function (options)
{
const requestOptions = prepareRequestOptions.call(this, options);

return axios.request(requestOptions);
let response = await axios.request(requestOptions);

if (Util.isString(response['data']) &&
response['headers']['content-type'] === 'application/json') {
response['data'] = JSON.parse(response['data']);
}

return normalizeResponse(response);
};

/**
Expand Down

0 comments on commit 8d8bd87

Please sign in to comment.