Fixed issue with null params sent with =#4440
Fixed issue with null params sent with =#4440rohitneharabrowserstack merged 4 commits intomasterfrom
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe diff changes query-parameter handling for HTTP requests. app/src/features/apiClient/helpers/httpRequestExecutor/httpRequestExecutor.ts now clones the request into a preparedEntryRequest, serializes its queryParams into the request URL via queryParamsToURLString (with encoding enabled) and clears the queryParams before calling makeRequest. app/src/features/apiClient/screens/apiClient/utils.ts updates queryParamsToURLString to accept an optional shouldEncode boolean (default false), treats null like no-value parameters, and encodes keys and values when shouldEncode is true. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/src/features/apiClient/screens/apiClient/utils.ts (1)
618-635:⚠️ Potential issue | 🟠 MajorPreserve existing URL query when
queryParamsis empty.This helper currently drops any query already present in
inputStringbecause it always rebuilds fromqueryParams. With the new executor usage, that can silently remove user-specified URL params.Proposed fix
export const queryParamsToURLString = (queryParams: KeyValuePair[], inputString: string, shouldEncode = false) => { + if (queryParams.length === 0) { + return inputString; + } const baseUrl = split(inputString, "?")[0]; const enabledParams = queryParams.filter((param) => param.isEnabled ?? true);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/features/apiClient/screens/apiClient/utils.ts` around lines 618 - 635, The helper queryParamsToURLString currently rebuilds the URL and drops any existing query when no params are provided; to fix this, in queryParamsToURLString (use symbols baseUrl, inputString, enabledParams) check if enabledParams.length === 0 (or there are no truthy keys to add) and if so simply return inputString as-is to preserve its existing query string; otherwise proceed with the current mapping/encoding logic to build and return `${baseUrl}?${queryString}` when queryString exists.
🧹 Nitpick comments (1)
app/src/features/apiClient/helpers/httpRequestExecutor/httpRequestExecutor.ts (1)
291-308: Log the same request object that is actually executed.After introducing
preparedEntryRequest, telemetry can diverge from real network behavior because logging still usespreparedEntry.request. For debugging/replay fidelity, logpreparedEntryRequest.Proposed refactor
- APIEventLogger.logRequest({ - request: preparedEntry.request, - workspaceId: this.ctx.workspaceId, - tag: { - recordId, - iteration: iterationContext.iteration, - executionId: execId, - }, - }); - const preparedEntryRequest = { ...preparedEntry.request, url: queryParamsToURLString(preparedEntry.request.queryParams, preparedEntry.request.url, true), queryParams: [], }; + APIEventLogger.logRequest({ + request: preparedEntryRequest, + workspaceId: this.ctx.workspaceId, + tag: { + recordId, + iteration: iterationContext.iteration, + executionId: execId, + }, + });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/features/apiClient/helpers/httpRequestExecutor/httpRequestExecutor.ts` around lines 291 - 308, The telemetry currently logs preparedEntry.request but the code actually executes preparedEntryRequest; compute/build preparedEntryRequest (the object with url from queryParamsToURLString and queryParams: []) before calling APIEventLogger.logRequest and pass preparedEntryRequest to APIEventLogger.logRequest instead of preparedEntry.request so the logged request matches what is passed to makeRequest (refer to preparedEntryRequest, preparedEntry.request, APIEventLogger.logRequest, and makeRequest).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@app/src/features/apiClient/screens/apiClient/utils.ts`:
- Around line 618-635: The helper queryParamsToURLString currently rebuilds the
URL and drops any existing query when no params are provided; to fix this, in
queryParamsToURLString (use symbols baseUrl, inputString, enabledParams) check
if enabledParams.length === 0 (or there are no truthy keys to add) and if so
simply return inputString as-is to preserve its existing query string; otherwise
proceed with the current mapping/encoding logic to build and return
`${baseUrl}?${queryString}` when queryString exists.
---
Nitpick comments:
In
`@app/src/features/apiClient/helpers/httpRequestExecutor/httpRequestExecutor.ts`:
- Around line 291-308: The telemetry currently logs preparedEntry.request but
the code actually executes preparedEntryRequest; compute/build
preparedEntryRequest (the object with url from queryParamsToURLString and
queryParams: []) before calling APIEventLogger.logRequest and pass
preparedEntryRequest to APIEventLogger.logRequest instead of
preparedEntry.request so the logged request matches what is passed to
makeRequest (refer to preparedEntryRequest, preparedEntry.request,
APIEventLogger.logRequest, and makeRequest).
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/src/features/apiClient/helpers/httpRequestExecutor/httpRequestExecutor.tsapp/src/features/apiClient/screens/apiClient/utils.ts
Closes issue:
📜 Summary of changes:
🎥 Demo Video:
Video/Demo:
✅ Checklist:
🧪 Test instructions:
🔗 Other references:
Summary by CodeRabbit
Bug Fixes
New Features