Skip to content

ENGG-5319 : Fix form-urlencoded body handling for GET requests#295

Open
srbh777 wants to merge 2 commits intomasterfrom
ENGG-5319
Open

ENGG-5319 : Fix form-urlencoded body handling for GET requests#295
srbh777 wants to merge 2 commits intomasterfrom
ENGG-5319

Conversation

@srbh777
Copy link

@srbh777 srbh777 commented Feb 19, 2026

Summary

  • Removed GET from the form-urlencoded body processing exclusion list so that GET requests with application/x-www-form-urlencoded content type are properly encoded

Context

The web app now allows GET request bodies in desktop mode. All content types (JSON, raw, multipart) were already handled correctly for GET, but form-urlencoded was explicitly skipped — causing the raw key-value pair array to be sent
instead of properly encoded URLSearchParams.

Changes

  • makeApiClientRequest.js: Changed !["GET", "HEAD"].includes(method) to method !== "HEAD" in the form-urlencoded body processing condition

Test plan

  • Send GET request with application/x-www-form-urlencoded body → server should receive properly encoded form data (e.g. key1=value1&key2=value2)
  • Send GET request with JSON body → should still work as before
  • Send GET request with raw body → should still work as before
  • Send POST/PUT/PATCH with form-urlencoded body → should still work as before
  • HEAD requests should still have no body

Summary by CodeRabbit

  • Bug Fixes
    • Fixed form-urlencoded request handling to apply consistently across all HTTP methods.

@linear
Copy link

linear bot commented Feb 19, 2026

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

Walkthrough

The change modifies the form-urlencoded request handling in the API client to remove the HTTP method guard. Previously, form-urlencoded content type processing only applied to non-GET/HEAD requests. The updated logic now processes form-urlencoded requests regardless of HTTP method, always constructing FormData from the body and converting it to URLSearchParams when contentType is "application/x-www-form-urlencoded". The remainder of the request handling logic for multipart/form-data and headers stays intact.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • wrongsahil
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: fixing form-urlencoded body handling for GET requests, which aligns with the PR's primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ENGG-5319

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/actions/makeApiClientRequest.js (1)

26-32: ⚠️ Potential issue | 🟠 Major

HEAD requests are no longer excluded — add back the method !== "HEAD" guard.

The PR description and test plan both state that HEAD requests should continue to have no body, and claim the new condition is method !== "HEAD". However, the actual code has no method check at all, meaning a HEAD request with Content-Type: application/x-www-form-urlencoded will now have a URLSearchParams body built and passed to axios — directly contradicting the stated intent.

🐛 Proposed fix
-    if (apiRequest.contentType === "application/x-www-form-urlencoded") {
+    if (method !== "HEAD" && apiRequest.contentType === "application/x-www-form-urlencoded") {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/actions/makeApiClientRequest.js` around lines 26 - 32, Add the
missing HEAD-method guard so HEAD requests keep no body: update the condition
around the form-urlencoded handling in makeApiClientRequest (the block that
checks apiRequest.contentType === "application/x-www-form-urlencoded") to also
require apiRequest.method !== "HEAD"; only build FormData/URLSearchParams and
assign to body when that combined condition is true so HEAD requests are
skipped.
🤖 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 `@src/main/actions/makeApiClientRequest.js`:
- Around line 26-32: Add the missing HEAD-method guard so HEAD requests keep no
body: update the condition around the form-urlencoded handling in
makeApiClientRequest (the block that checks apiRequest.contentType ===
"application/x-www-form-urlencoded") to also require apiRequest.method !==
"HEAD"; only build FormData/URLSearchParams and assign to body when that
combined condition is true so HEAD requests are skipped.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f31ef7e and de13761.

📒 Files selected for processing (1)
  • src/main/actions/makeApiClientRequest.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants