Skip to content

Commit

Permalink
SNOW-1814745-Fix-aborting-requests-in-HttpClient: commented the mockH…
Browse files Browse the repository at this point in the history
…ttpClient
  • Loading branch information
sfc-gh-fpawlowski committed Dec 16, 2024
1 parent 196082f commit a196604
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/unit/mock/mock_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,12 @@ function createSortedClone(target) {

function removeParamFromRequestUrl(request, paramName) {
try {
// Use the URL constructor to parse the URL
const urlObj = new URL(request.url);
urlObj.searchParams.delete(paramName);
request.url = urlObj.toString();
} catch (error) {
// Handle invalid URLs or other errors
throw `Invalid URL: ${request.url} Error: ${error}`;
}
}
Expand All @@ -189,10 +191,12 @@ function removeParamFromRequestUrl(request, paramName) {
*/
function removeParamFromRequestParams(request, paramName) {
if (request && request.params && typeof request.params === 'object') {
// Delete the specified parameter
delete request.params[paramName];

// Check if params is now empty
if (Object.keys(request.params).length === 0) {
// If params property is empty, remove it
// Remove the entire params property
delete request.params;
}
}
Expand Down

0 comments on commit a196604

Please sign in to comment.