Skip to content

refactor: move hardcoded request type values to constants#7312

Open
sparkigniter wants to merge 4 commits intousebruno:mainfrom
sparkigniter:refactor/move_hardcoded_request_types_constant
Open

refactor: move hardcoded request type values to constants#7312
sparkigniter wants to merge 4 commits intousebruno:mainfrom
sparkigniter:refactor/move_hardcoded_request_types_constant

Conversation

@sparkigniter
Copy link
Copy Markdown

@sparkigniter sparkigniter commented Feb 26, 2026

Description

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

🛠 Refactor: Centralize Request Type Constants

This PR removes hardcoded request type string literals across the codebase and replaces them with a centralized REQUEST_TYPES constant.


🧹 What Changed

  • Introduced a structured REQUEST_TYPES constant to define all supported request types.
  • Replaced scattered string literals (e.g. "http", "graphql", etc.) with references to REQUEST_TYPES.
  • Updated related components, utilities, and store logic to use the new constants.

🎯 Why This Change?

  • Improves maintainability – Avoids duplication of request type strings.
  • Reduces risk of typos and inconsistencies – Central source of truth.
  • Easier future enhancements – Adding or modifying request types becomes straightforward.

🧪 Impact

  • No functional changes.
  • No UI changes.
  • Existing behavior remains intact.
  • All tests pass.

📌 Example

Before:

if (request.type === 'http-request') { ... }

After:

if (request.type === REQUEST_TYPES.HTTP) { ... }

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • Chores
    • Standardized request-type handling across the app for consistent creation, detection, and defaults (including curl import behavior).
  • Bug Fixes
    • Fixed UI inconsistencies: action/menu visibility, request method display, response bookmarking, and request pane/tab behavior.
    • Improved export and collection handling: better preservation and cleaning of example/request metadata and adjusted resequencing after deletions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 26, 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: c922ce26-b373-4037-9d92-fb4f84186ffe

📥 Commits

Reviewing files that changed from the base of the PR and between e98a20b and 8f9b57b.

📒 Files selected for processing (3)
  • packages/bruno-app/src/components/RequestTabPanel/index.js
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js
  • packages/bruno-app/src/components/RequestTabPanel/index.js

Walkthrough

Replaces scattered hard-coded request-type string literals with a centralized REQUEST_TYPES object and updates consumers to use the new keys; one export (REQUEST_TYPES) changed shape from Array → Object. No public API signatures were otherwise altered.

Changes

Cohort / File(s) Summary
Constants Definition
packages/bruno-app/src/utils/common/constants.js
Convert REQUEST_TYPES from a flat array to an object with keys HTTP_REQUEST, GRAPHQL_REQUEST, GRPC_REQUEST, WS_REQUEST (type changed from Array → Object).
Component UI Layers
packages/bruno-app/src/components/CreateTransientRequest/index.js, packages/bruno-app/src/components/CreateUntitledRequest/index.js, packages/bruno-app/src/components/RequestPane/QueryUrl/index.js, packages/bruno-app/src/components/RequestTabPanel/index.js, packages/bruno-app/src/components/ResponsePane/ResponseBookmark/index.js, packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js
Replace literal request-type strings with REQUEST_TYPES property references in creation flows, paste handling, render switches, and action/menu visibility checks.
Sidebar Components
packages/bruno-app/src/components/Sidebar/.../RequestMethod/index.js, packages/bruno-app/src/components/Sidebar/.../CollectionItem/index.js, packages/bruno-app/src/components/Sidebar/NewRequest/index.js
Switch request-type conditionals, UI labels, default selection, and curl-detection mappings to use REQUEST_TYPES keys.
Collections & Export Utilities
packages/bruno-app/src/utils/collections/index.js, packages/bruno-app/src/utils/collections/export.js
Use REQUEST_TYPES keys for item-type checks, example-type remapping, UID deletions, and transform logic; broadened handling to include grpc/ws via constants.
Curl & Network Utilities
packages/bruno-app/src/utils/curl/index.js, packages/bruno-app/src/utils/network/index.js
Change default parameter and conditional checks to use REQUEST_TYPES constants for curl parsing and network dispatch filtering.
Tabs Utility
packages/bruno-app/src/utils/tabs/index.js
Update isItemARequest and related tab logic to check REQUEST_TYPES keys instead of array literals.
Redux Slice
packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
Change deletion-reordering type set to use Object.values(REQUEST_TYPES) (plus 'folder') so all enum values are included in resequencing filters.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • lohit-bruno
  • naman-bruno
  • bijin-bruno

Poem

Constants gather, scattered strings depart,
Keys now steer each request's chart.
One object speaks where literals played,
Cleaner checks, fewer shades. 🌟

🚥 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 accurately and concisely describes the main change: refactoring hardcoded request type values into a centralized constant, which is reflected across all modified files.
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
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

Actionable comments posted: 2

Caution

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

⚠️ Outside diff range comments (7)
packages/bruno-app/src/components/RequestPane/QueryUrl/index.js (1)

89-92: ⚠️ Potential issue | 🟡 Minor

Inconsistent: handleGraphqlPaste still uses hardcoded string.

handleHttpPaste (line 164) correctly uses REQUEST_TYPES.HTTP_REQUEST, but handleGraphqlPaste still checks against the literal 'graphql-request'. Should use REQUEST_TYPES.GRAPHQL_REQUEST for consistency.

🔧 Proposed fix
   const handleGraphqlPaste = useCallback((event) => {
-    if (item.type !== 'graphql-request') {
+    if (item.type !== REQUEST_TYPES.GRAPHQL_REQUEST) {
       return;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/RequestPane/QueryUrl/index.js` around lines
89 - 92, Replace the hardcoded type check in handleGraphqlPaste with the shared
enum constant: change the conditional that compares item.type to the string
'graphql-request' to instead compare to REQUEST_TYPES.GRAPHQL_REQUEST
(consistent with handleHttpPaste which uses REQUEST_TYPES.HTTP_REQUEST),
ensuring you import or reference REQUEST_TYPES where handleGraphqlPaste is
defined.
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js (1)

166-166: ⚠️ Potential issue | 🟡 Minor

Missed constant usage: hardcoded string literal remains.

Line 166 still uses the hardcoded string 'graphql-request' while line 150 correctly uses REQUEST_TYPES.GRAPHQL_REQUEST. This should be consistent with the refactoring pattern.

🔧 Proposed fix
-        {item.type !== 'graphql-request' && <ResponseBookmark ref={bookmarkButtonRef} item={item} collection={collection} responseSize={responseSize} />}
+        {item.type !== REQUEST_TYPES.GRAPHQL_REQUEST && <ResponseBookmark ref={bookmarkButtonRef} item={item} collection={collection} responseSize={responseSize} />}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js`
at line 166, Replace the hardcoded string check in ResponsePaneActions (the
conditional rendering that uses item.type !== 'graphql-request') with the
refactored constant: use REQUEST_TYPES.GRAPHQL_REQUEST instead of the string
literal so it matches the earlier check and the new pattern (update the
conditional that controls rendering of ResponseBookmark which references
item.type to compare against REQUEST_TYPES.GRAPHQL_REQUEST).
packages/bruno-app/src/components/Sidebar/NewRequest/index.js (2)

59-72: ⚠️ Potential issue | 🟡 Minor

Inconsistent: identifyCurlRequestType mixes hardcoded strings with constants.

Lines 61 and 67 use hardcoded 'graphql-request' while line 71 uses REQUEST_TYPES.HTTP_REQUEST. Apply constants consistently throughout.

🔧 Proposed fix
   const identifyCurlRequestType = (url, headers, body) => {
     if (url.endsWith('/graphql')) {
-      setCurlRequestTypeDetected('graphql-request');
+      setCurlRequestTypeDetected(REQUEST_TYPES.GRAPHQL_REQUEST);
       return;
     }

     const contentType = headers?.find((h) => h.name.toLowerCase() === 'content-type')?.value;
     if (contentType && contentType.includes('application/graphql')) {
-      setCurlRequestTypeDetected('graphql-request');
+      setCurlRequestTypeDetected(REQUEST_TYPES.GRAPHQL_REQUEST);
       return;
     }

     setCurlRequestTypeDetected(REQUEST_TYPES.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
59 - 72, identifyCurlRequestType currently sets 'graphql-request' as a hardcoded
string in two places; replace those with the matching constant from
REQUEST_TYPES (e.g., REQUEST_TYPES.GRAPHQL_REQUEST) and use that constant
everywhere instead of the literal, updating both the url.endsWith('/graphql')
branch and the contentType check; if REQUEST_TYPES does not yet expose a
GRAPHQL_REQUEST key, add it and use that key when calling
setCurlRequestTypeDetected to keep constants consistent with the existing
REQUEST_TYPES.HTTP_REQUEST usage.

549-568: ⚠️ Potential issue | 🟡 Minor

Inconsistent: Dropdown curlRequestTypeChange calls use hardcoded strings.

The dropdown items at lines 554 and 563 pass hardcoded strings 'http-request' and 'graphql-request' to curlRequestTypeChange. These should use the constants.

🔧 Proposed fix
                     <div
                       className="dropdown-item"
                       onClick={() => {
                         dropdownTippyRef.current.hide();
-                        curlRequestTypeChange('http-request');
+                        curlRequestTypeChange(REQUEST_TYPES.HTTP_REQUEST);
                       }}
                     >
                       HTTP
                     </div>
                     <div
                       className="dropdown-item"
                       onClick={() => {
                         dropdownTippyRef.current.hide();
-                        curlRequestTypeChange('graphql-request');
+                        curlRequestTypeChange(REQUEST_TYPES.GRAPHQL_REQUEST);
                       }}
                     >
                       GraphQL
                     </div>
🤖 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
549 - 568, Replace the hardcoded strings passed to curlRequestTypeChange in the
Dropdown items with the project constants for request types: instead of
'http-request' and 'graphql-request' use the defined constants (e.g., the
module's HTTP and GRAPHQL request-type constants) and ensure the constants are
imported at the top of the file; keep the existing Dropdown,
dropdownTippyRef.current.hide(), and curlRequestTypeChange(...) calls but pass
the constant identifiers rather than string literals.
packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RequestMethod/index.js (1)

6-10: ⚠️ Potential issue | 🟡 Minor

Inconsistent: getMethodFlags still uses hardcoded strings.

Line 38 correctly uses REQUEST_TYPES constants, but getMethodFlags at lines 7-9 still compares against hardcoded strings. Apply constants consistently.

🔧 Proposed fix
 const getMethodFlags = (item) => ({
-  isGrpc: item.type === 'grpc-request',
-  isWS: item.type === 'ws-request',
-  isGraphQL: item.type === 'graphql-request'
+  isGrpc: item.type === REQUEST_TYPES.GRPC_REQUEST,
+  isWS: item.type === REQUEST_TYPES.WS_REQUEST,
+  isGraphQL: item.type === REQUEST_TYPES.GRAPHQL_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/Collections/Collection/CollectionItem/RequestMethod/index.js`
around lines 6 - 10, getMethodFlags uses hardcoded type strings; update it to
use the REQUEST_TYPES constants instead. Locate getMethodFlags and replace
comparisons like item.type === 'grpc-request' / 'ws-request' / 'graphql-request'
with the corresponding REQUEST_TYPES properties (e.g. REQUEST_TYPES.GRPC,
REQUEST_TYPES.WS, REQUEST_TYPES.GRAPHQL or the exact keys used elsewhere in the
codebase) so the function consistently relies on REQUEST_TYPES.
packages/bruno-app/src/components/CreateUntitledRequest/index.js (1)

47-47: ⚠️ Potential issue | 🟡 Minor

Inconsistent: handleCreateGraphQLRequest still uses hardcoded string.

handleCreateHttpRequest (line 25) uses REQUEST_TYPES.HTTP_REQUEST, but handleCreateGraphQLRequest uses the literal 'graphql-request'. Apply the constant consistently.

🔧 Proposed fix
-        requestType: 'graphql-request',
+        requestType: REQUEST_TYPES.GRAPHQL_REQUEST,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/CreateUntitledRequest/index.js` at line 47,
The GraphQL create handler is using a hardcoded string; update
handleCreateGraphQLRequest to use the same REQUEST_TYPES constant as
handleCreateHttpRequest (i.e., replace 'graphql-request' with
REQUEST_TYPES.GRAPHQL_REQUEST) and ensure REQUEST_TYPES is referenced/imported
where handleCreateGraphQLRequest is defined so both handlers use the shared
constant.
packages/bruno-app/src/utils/collections/export.js (1)

11-19: ⚠️ Potential issue | 🟡 Minor

UID cleanup misses WebSocket requests and uses the wrong assertions path.

Line 11 excludes REQUEST_TYPES.WS_REQUEST, and Line 16 targets request.vars.assertions instead of request.assertions. This leaves assertion/body/header-related UIDs behind in exported request payloads.

🔧 Proposed fix
-    if ([REQUEST_TYPES.HTTP_REQUEST, REQUEST_TYPES.GRAPHQL_REQUEST, REQUEST_TYPES.GRPC_REQUEST].includes(item.type)) {
+    if ([REQUEST_TYPES.HTTP_REQUEST, REQUEST_TYPES.GRAPHQL_REQUEST, REQUEST_TYPES.GRPC_REQUEST, REQUEST_TYPES.WS_REQUEST].includes(item.type)) {
       each(get(item, 'request.headers'), (header) => delete header.uid);
       each(get(item, 'request.params'), (param) => delete param.uid);
       each(get(item, 'request.vars.req'), (v) => delete v.uid);
       each(get(item, 'request.vars.res'), (v) => delete v.uid);
-      each(get(item, 'request.vars.assertions'), (a) => delete a.uid);
+      each(get(item, 'request.assertions'), (a) => delete a.uid);
       each(get(item, 'request.body.multipartForm'), (param) => delete param.uid);
       each(get(item, 'request.body.formUrlEncoded'), (param) => delete param.uid);
       each(get(item, 'request.body.file'), (param) => delete param.uid);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/utils/collections/export.js` around lines 11 - 19, The
UID cleanup block that runs for HTTP/GraphQL/gRPC requests should also include
WebSocket requests and should target the correct assertions path; update the
includes array to add REQUEST_TYPES.WS_REQUEST and change the assertions cleanup
from get(item, 'request.vars.assertions') to get(item, 'request.assertions') in
the same block (the code around the conditional handling these items and the
each(get(item, ...)) calls) so headers, params, body and assertions UIDs are
removed for WS requests too.
🧹 Nitpick comments (1)
packages/bruno-app/src/components/RequestPane/QueryUrl/index.js (1)

104-104: Consider using constant for the getRequestFromCurlCommand parameter.

The hardcoded 'graphql-request' passed to getRequestFromCurlCommand could use REQUEST_TYPES.GRAPHQL_REQUEST for consistency.

🔧 Suggested change
-      const request = getRequestFromCurlCommand(pastedData, 'graphql-request');
+      const request = getRequestFromCurlCommand(pastedData, REQUEST_TYPES.GRAPHQL_REQUEST);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/RequestPane/QueryUrl/index.js` at line 104,
Replace the hardcoded string 'graphql-request' passed to
getRequestFromCurlCommand with the enum/constant REQUEST_TYPES.GRAPHQL_REQUEST;
update the call in QueryUrl (the getRequestFromCurlCommand(...) invocation) to
use REQUEST_TYPES.GRAPHQL_REQUEST and add the necessary import for REQUEST_TYPES
where it's defined so the code compiles and remains consistent with other
request-type usages.
🤖 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/Collections/Collection/CollectionItem/index.js`:
- Line 94: The examples-check incorrectly restricts example expansion to GRAPHQL
requests: update the hasExamples expression in the CollectionItem component to
detect HTTP requests instead of REQUEST_TYPES.GRAPHQL_REQUEST by using the
correct HTTP request type constant from REQUEST_TYPES (so that
isItemARequest(item) && item.type === REQUEST_TYPES.<HTTP_REQUEST_CONSTANT> &&
item.examples && item.examples.length > 0); this will re-enable HTTP example
expansion and keep the examples boolean in sync with the component's render
gate.

In `@packages/bruno-app/src/utils/curl/index.js`:
- Line 7: The default parameter for getRequestFromCurlCommand is hardcoded to
'http-request' but the function body expects REQUEST_TYPES.HTTP_REQUEST; change
the function signature to use REQUEST_TYPES.HTTP_REQUEST as the default (ensure
REQUEST_TYPES is imported/available in this module) so the default and body are
consistent; update any local references if needed to match the constant name.

---

Outside diff comments:
In `@packages/bruno-app/src/components/CreateUntitledRequest/index.js`:
- Line 47: The GraphQL create handler is using a hardcoded string; update
handleCreateGraphQLRequest to use the same REQUEST_TYPES constant as
handleCreateHttpRequest (i.e., replace 'graphql-request' with
REQUEST_TYPES.GRAPHQL_REQUEST) and ensure REQUEST_TYPES is referenced/imported
where handleCreateGraphQLRequest is defined so both handlers use the shared
constant.

In `@packages/bruno-app/src/components/RequestPane/QueryUrl/index.js`:
- Around line 89-92: Replace the hardcoded type check in handleGraphqlPaste with
the shared enum constant: change the conditional that compares item.type to the
string 'graphql-request' to instead compare to REQUEST_TYPES.GRAPHQL_REQUEST
(consistent with handleHttpPaste which uses REQUEST_TYPES.HTTP_REQUEST),
ensuring you import or reference REQUEST_TYPES where handleGraphqlPaste is
defined.

In `@packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js`:
- Line 166: Replace the hardcoded string check in ResponsePaneActions (the
conditional rendering that uses item.type !== 'graphql-request') with the
refactored constant: use REQUEST_TYPES.GRAPHQL_REQUEST instead of the string
literal so it matches the earlier check and the new pattern (update the
conditional that controls rendering of ResponseBookmark which references
item.type to compare against REQUEST_TYPES.GRAPHQL_REQUEST).

In
`@packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RequestMethod/index.js`:
- Around line 6-10: getMethodFlags uses hardcoded type strings; update it to use
the REQUEST_TYPES constants instead. Locate getMethodFlags and replace
comparisons like item.type === 'grpc-request' / 'ws-request' / 'graphql-request'
with the corresponding REQUEST_TYPES properties (e.g. REQUEST_TYPES.GRPC,
REQUEST_TYPES.WS, REQUEST_TYPES.GRAPHQL or the exact keys used elsewhere in the
codebase) so the function consistently relies on REQUEST_TYPES.

In `@packages/bruno-app/src/components/Sidebar/NewRequest/index.js`:
- Around line 59-72: identifyCurlRequestType currently sets 'graphql-request' as
a hardcoded string in two places; replace those with the matching constant from
REQUEST_TYPES (e.g., REQUEST_TYPES.GRAPHQL_REQUEST) and use that constant
everywhere instead of the literal, updating both the url.endsWith('/graphql')
branch and the contentType check; if REQUEST_TYPES does not yet expose a
GRAPHQL_REQUEST key, add it and use that key when calling
setCurlRequestTypeDetected to keep constants consistent with the existing
REQUEST_TYPES.HTTP_REQUEST usage.
- Around line 549-568: Replace the hardcoded strings passed to
curlRequestTypeChange in the Dropdown items with the project constants for
request types: instead of 'http-request' and 'graphql-request' use the defined
constants (e.g., the module's HTTP and GRAPHQL request-type constants) and
ensure the constants are imported at the top of the file; keep the existing
Dropdown, dropdownTippyRef.current.hide(), and curlRequestTypeChange(...) calls
but pass the constant identifiers rather than string literals.

In `@packages/bruno-app/src/utils/collections/export.js`:
- Around line 11-19: The UID cleanup block that runs for HTTP/GraphQL/gRPC
requests should also include WebSocket requests and should target the correct
assertions path; update the includes array to add REQUEST_TYPES.WS_REQUEST and
change the assertions cleanup from get(item, 'request.vars.assertions') to
get(item, 'request.assertions') in the same block (the code around the
conditional handling these items and the each(get(item, ...)) calls) so headers,
params, body and assertions UIDs are removed for WS requests too.

---

Nitpick comments:
In `@packages/bruno-app/src/components/RequestPane/QueryUrl/index.js`:
- Line 104: Replace the hardcoded string 'graphql-request' passed to
getRequestFromCurlCommand with the enum/constant REQUEST_TYPES.GRAPHQL_REQUEST;
update the call in QueryUrl (the getRequestFromCurlCommand(...) invocation) to
use REQUEST_TYPES.GRAPHQL_REQUEST and add the necessary import for REQUEST_TYPES
where it's defined so the code compiles and remains consistent with other
request-type usages.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0d0e4a and ec063dc.

📒 Files selected for processing (16)
  • packages/bruno-app/src/components/CreateTransientRequest/index.js
  • packages/bruno-app/src/components/CreateUntitledRequest/index.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/index.js
  • packages/bruno-app/src/components/RequestTabPanel/index.js
  • packages/bruno-app/src/components/ResponsePane/ResponseBookmark/index.js
  • packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RequestMethod/index.js
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js
  • packages/bruno-app/src/components/Sidebar/NewRequest/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
  • packages/bruno-app/src/utils/collections/export.js
  • packages/bruno-app/src/utils/collections/index.js
  • packages/bruno-app/src/utils/common/constants.js
  • packages/bruno-app/src/utils/curl/index.js
  • packages/bruno-app/src/utils/network/index.js
  • packages/bruno-app/src/utils/tabs/index.js

Comment thread packages/bruno-app/src/utils/curl/index.js Outdated
@sparkigniter sparkigniter marked this pull request as draft February 26, 2026 13:04
@sparkigniter sparkigniter marked this pull request as ready for review February 26, 2026 13:15
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/utils/collections/index.js (1)

854-856: Correct usage of constants, but inconsistent with other parts of the file.

The change correctly replaces hardcoded strings with REQUEST_TYPES constants. However, there are remaining hardcoded request type strings in unchanged code within this same file:

  • Line 303: si.type === 'grpc-request'
  • Line 710: _item.type === 'grpc-request'
  • Line 716: _item.type === 'ws-request'
  • Line 723: ['grpc-request', 'ws-request'].includes(_item.type)

Consider updating these for consistency in a follow-up or within this PR.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/utils/collections/index.js` around lines 854 - 856,
Several places still use hardcoded request type strings; replace those literals
with the REQUEST_TYPES constants for consistency. Specifically, update
occurrences where code checks si.type === 'grpc-request' and where _item.type
=== 'grpc-request' / _item.type === 'ws-request' and the array check
['grpc-request','ws-request'].includes(_item.type) to use
REQUEST_TYPES.GRPC_REQUEST and REQUEST_TYPES.WS_REQUEST (e.g., si.type ===
REQUEST_TYPES.GRPC_REQUEST, _item.type === REQUEST_TYPES.GRPC_REQUEST,
_item.type === REQUEST_TYPES.WS_REQUEST, and [REQUEST_TYPES.GRPC_REQUEST,
REQUEST_TYPES.WS_REQUEST].includes(_item.type)). Ensure you import or reference
REQUEST_TYPES the same way as in isItemARequest so the module compiles.
🤖 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/utils/collections/index.js`:
- Around line 854-856: Several places still use hardcoded request type strings;
replace those literals with the REQUEST_TYPES constants for consistency.
Specifically, update occurrences where code checks si.type === 'grpc-request'
and where _item.type === 'grpc-request' / _item.type === 'ws-request' and the
array check ['grpc-request','ws-request'].includes(_item.type) to use
REQUEST_TYPES.GRPC_REQUEST and REQUEST_TYPES.WS_REQUEST (e.g., si.type ===
REQUEST_TYPES.GRPC_REQUEST, _item.type === REQUEST_TYPES.GRPC_REQUEST,
_item.type === REQUEST_TYPES.WS_REQUEST, and [REQUEST_TYPES.GRPC_REQUEST,
REQUEST_TYPES.WS_REQUEST].includes(_item.type)). Ensure you import or reference
REQUEST_TYPES the same way as in isItemARequest so the module compiles.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20deaed and e98a20b.

📒 Files selected for processing (3)
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
  • packages/bruno-app/src/utils/collections/index.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/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