Skip to content

make post default gql method#7713

Open
ganesh-bruno wants to merge 4 commits intousebruno:mainfrom
ganesh-bruno:fix/default-post-gql
Open

make post default gql method#7713
ganesh-bruno wants to merge 4 commits intousebruno:mainfrom
ganesh-bruno:fix/default-post-gql

Conversation

@ganesh-bruno
Copy link
Copy Markdown
Collaborator

@ganesh-bruno ganesh-bruno commented Apr 8, 2026

  • Make POST as a default method for gql req which user can change but while creating the default will be POST
Screen.Recording.2026-04-08.at.6.44.17.PM.mov

Summary by CodeRabbit

  • Bug Fixes
    • GraphQL requests now default to POST instead of GET for new requests.
    • Switching a request to GraphQL applies the POST method by default to avoid method/type mismatch.
    • Changing the request type to HTTP or gRPC now forces the HTTP method back to GET to ensure compatibility.
    • Selecting a WebSocket request type sets the request method to WS automatically.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4aa3bfbe-482d-4eea-ad60-6acefc695476

📥 Commits

Reviewing files that changed from the base of the PR and between 364674f and 235ffaf.

📒 Files selected for processing (1)
  • packages/bruno-app/src/components/Sidebar/NewRequest/index.js
✅ Files skipped from review due to trivial changes (1)
  • packages/bruno-app/src/components/Sidebar/NewRequest/index.js

Walkthrough

Set NewRequest's requestMethod initial value to 'POST' when getRequestType(collectionPresets) returns 'graphql-request', otherwise 'GET'. Radio onChange handlers now force requestMethod after formik.handleChange for http-request ('GET'), grpc-request ('GET'), and ws-request ('ws'); graphql-request uses only formik.handleChange.

Changes

Cohort / File(s) Summary
NewRequest component
packages/bruno-app/src/components/Sidebar/NewRequest/index.js
initialValues.requestMethod is conditional: 'POST' when getRequestType(collectionPresets) === 'graphql-request', otherwise 'GET'. Updated radio onChange handlers to call formik.handleChange then set requestMethod for http-request ('GET'), grpc-request ('GET'), and ws-request ('ws'). graphql-request radio remains using only formik.handleChange.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A radio flip, a seedling choice,
GraphQL posts gain a louder voice,
GETs restored where needed most,
WS whispers through the host,
Small changes, smooth the requester's voice. 🎉

🚥 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 concisely summarizes the main change: making POST the default HTTP method for GraphQL requests.
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 unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
Contributor

@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.

🧹 Nitpick comments (1)
packages/bruno-app/src/components/Sidebar/NewRequest/index.js (1)

340-363: Consider resetting method to GET when switching back to HTTP.

The GraphQL radio now forces POST, but the HTTP radio (lines 340-348) still uses plain formik.handleChange. If a user selects GraphQL (sets method to POST) then switches back to HTTP, the method remains POST. This asymmetry may confuse users expecting a "clean slate."

For consistency, consider applying the same pattern to the HTTP radio:

♻️ Suggested change for HTTP radio
                     <input
                       type="radio"
                       id="http-request"
                       name="requestType"
                       value="http-request"
                       checked={formik.values.requestType === 'http-request'}
-                      onChange={formik.handleChange}
+                      onChange={(e) => {
+                        formik.handleChange(e);
+                        formik.setFieldValue('requestMethod', 'GET');
+                      }}
                       data-testid="http-request"
                     />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/Sidebar/NewRequest/index.js` around lines
340 - 363, The HTTP radio input (id "http-request", name "requestType")
currently only calls formik.handleChange so if the user previously picked
GraphQL (which sets requestMethod to 'POST' in the graphql radio onChange), the
method remains POST; update the HTTP radio's onChange to call
formik.handleChange(e) and also call formik.setFieldValue('requestMethod',
'GET') so switching back to HTTP resets the method to GET.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/bruno-app/src/components/Sidebar/NewRequest/index.js`:
- Around line 340-363: The HTTP radio input (id "http-request", name
"requestType") currently only calls formik.handleChange so if the user
previously picked GraphQL (which sets requestMethod to 'POST' in the graphql
radio onChange), the method remains POST; update the HTTP radio's onChange to
call formik.handleChange(e) and also call formik.setFieldValue('requestMethod',
'GET') so switching back to HTTP resets the method to GET.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 079d4406-40ed-472f-b823-b92d34645244

📥 Commits

Reviewing files that changed from the base of the PR and between 3b502fd and cdc6663.

📒 Files selected for processing (1)
  • packages/bruno-app/src/components/Sidebar/NewRequest/index.js

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Apr 8, 2026
Copy link
Copy Markdown
Contributor

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/bruno-app/src/components/Sidebar/NewRequest/index.js`:
- Around line 264-267: The WebSocket radio currently calls formik.handleChange
directly which leaves requestMethod set to 'POST' after switching from GraphQL;
update the WebSocket radio to use handleRequestTypeChange (or create a new
onChange handler) so that when request type is 'websocket' you call
formik.setFieldValue('requestMethod', 'ws') (or set it to 'ws' explicitly) to
mirror other WS creation paths and prevent newWsRequest from inheriting an HTTP
method; locate the radio input that currently uses formik.handleChange and
replace it with handleRequestTypeChange or a small wrapper that sets
requestMethod to 'ws'.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b3a34f5b-2c9d-42d3-9db7-2c29fb2e2bc5

📥 Commits

Reviewing files that changed from the base of the PR and between cdc6663 and 61f956a.

📒 Files selected for processing (1)
  • packages/bruno-app/src/components/Sidebar/NewRequest/index.js

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant