* feat: enhance API spec export with environment variables support
- Updated `exportApiSpec` function to accept and process environment variables for multi-server exports.
- Added logic to convert environment variables into a structured format for OpenAPI server entries.
- Enhanced the `CreateApiSpec` component to include environments in the exported YAML content.
- Introduced unit tests to validate the handling of server variables and their integration into the exported API specifications.
* refactor: streamline API spec export logic and improve variable handling
- Simplified variable extraction in `exportApiSpec` by directly assigning capture groups.
- Updated URL interpolation to use request variables instead of global variables for better accuracy.
- Enhanced handling of request body types by replacing early returns with breaks for clearer flow control.
- Adjusted tests to ensure backward compatibility with OpenAPI specifications and server variable handling.
* refactor: improve variable handling and URL processing in OpenAPI exporters
- Streamlined server variable assignment in `exportApiSpec` to handle undefined values more gracefully.
- Enhanced URL path extraction to ensure leading slashes are preserved in `getDefaultUrl` and `extractServerVars`.
- Updated string replacement logic to use `replaceAll` for consistent variable substitution in URLs.
* feat(sidebar): show "Add request" cta when collection or folder is empty
* fix: add connector lines and keyboard accessibility to empty-state CTA
* fix: debounce empty collection state to prevent flicker
Add 300ms delay before showing "Add request" button for empty collections.
This fixes a race condition where isLoading becomes false before the
items batch arrives from IPC, causing a brief flicker of the empty state.
Made-with: Cursor
---------
Co-authored-by: naman-bruno <naman@usebruno.com>
getCachedSystemProxy now awaits the initialization promise, preventing a race
condition where API calls made early in startup would bypass the system proxy.
* feat: add tokenType support for OAuth2
* refactor: rename tokenType to source in OpenCollection OAuth2 mapping
* refactor: rename tokenType to source in OAuth2 configuration
* chore: bump @opencollection/types to ~0.8.0
* fix: correct OAuth2 token type label in token viewer
* refactor: replace Dropdown with MenuDropdown in OAuth2 components
Migrate all 12 dropdown instances across 5 OAuth2 auth components to use
the MenuDropdown component, removing manual tippy ref management and
forwardRef icon patterns in favor of a declarative items-based API.
* fix(oauth2): prevent false callback matches on root path URLs and handle errors first
Move error check before callback URL matching in onWindowRedirect so
OAuth error responses are rejected immediately. Remove redundant error
param check from matchesCallbackUrl and require a code param or hash
fragment to match, preventing false positives on intermediate pages
when the callback URL is a root path like https://hostname/.
* fix(oauth2): clarify error handling comment
Remove "on the callback URL" from comment since error checking
now happens before callback URL matching.
* fix: multipart form-data file param export/import for Postman
* fix: Postman import compatibility for multipart form-data file params
This commit fixes two issues that caused Postman to fail importing
Bruno-exported collections with multipart form-data file parameters:
1. Changed `src` field format to match Postman's export format:
- Single file: export as string (e.g., "/path/to/file")
- Multiple files: export as array (e.g., ["/path/a", "/path/b"])
- Empty/null: export as null
Previously, Bruno always exported `src` as an array, but Postman's
importer expects a string for single files and fails to recognize
the file type and path when given an array.
2. Added `protocolProfileBehavior.disableBodyPruning` for GET/HEAD/OPTIONS
requests that have a body:
By default, Postman discards request bodies for HTTP methods that
typically don't have bodies (GET, HEAD, OPTIONS). Without this flag,
importing a GET request with a form-data body would result in the
body being silently dropped, making Postman unable to identify that
the request has a formdata body at all.
Both changes align Bruno's Postman export format with Postman's own
export format, ensuring full import compatibility.
---------
Co-authored-by: Chirag Chandrashekhar <cchirag85@gmail.com>
* feat(snippet-generator): implement encodeUrl setting to control URL encoding in generated snippets
* refactor(snippet-generator): rename and enhance URL encoding logic for better clarity and functionality
* feat(snippet-generator): enhance raw URL handling to preserve user encoding choices and improve snippet generation
* test(snippet-generator): add tests for URL fragment handling based on encodeUrl setting
* test(snippet-generator): improve comments on URL fragment handling to clarify RFC compliance
* feat(url): enhance interpolateUrlPathParams to support raw URL handling, preserving user encoding choices for snippet generation
* fix(url): ensure URLs are prefixed with http:// if missing in interpolateUrlPathParams function
* refactor(snippet-generator): streamline URL handling logic to improve snippet generation and ensure proper encoding based on settings
* feat(url): add stripOrigin utility to simplify URL processing in snippet generation
* test(snippet-generator): add test for double-encoding of pre-encoded URLs when encodeUrl is true
* feat(encoding): implement URL encoding settings and add tests for encoding behavior
* fix: address PR review comments (#7187)
- Remove unnecessary no-op jest.mock for @usebruno/common/utils
- Add length guard to prevent catastrophic replaceAll('/') on root-path URLs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* empty commit
* fix(tests): update interpolateUrlPathParams tests to use correct parameter structure
* empty commit
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add ensureActiveTabInCurrentWorkspace action and improve tab management
* refactor: enhance tab focus logic for current workspace and improve tab management
* tests: implement test for getTabToFocusForCurrentWorkspace logic and added a playwright
* refactor: improve comments for tab management logic and enhance workspace tab focus handling in tests
* refactor: ensure active tab in current workspace after collection removal and enhance tests for tab focus logic
* trigger build
* fix: tags schema updatd to array of string
* tests: added test cases for sanitizing tags, openapi-tags
* fix: enhance tag sanitization to support object input and UTF characters
---------
Co-authored-by: shubh-bruno <shubh-bruno@shubh-bruno.local>
* allow international characters in tag regex for UI and schema
validation
* update validation messages to match this
Co-authored-by: Miro Metsänheimo <miro.metsanheimo@cgi.com>
Prevent app crashes when loading GraphQL schemas with validation errors
(e.g., object types with no fields). The fix:
- Validates schemas using validateSchema() and shows warnings for issues
- Still loads the schema so autocomplete continues to work
- Wraps the CodeMirror GraphQL linter with error handling to catch
any validation errors during linting
Fixes#4529
Co-authored-by: Chirag Chandrashekhar <cchirag85@gmail.com>
* feat(): support multipart mixed
fix: support vars interpolation on mixed multi-part
Update packages/bruno-electron/src/ipc/network/interpolate-vars.js
Co-authored-by: Timon <39559178+Its-treason@users.noreply.github.com>
refactor: use startsWith
feat: best effort for other multipart/* contentypes
* feat: enhance variable interpolation for multipart requests
- Updated `interpolateVars` function to support interpolation in multipart/form-data and multipart/mixed requests.
- Added handling for empty multipart arrays and parts with missing or undefined values.
- Improved type checks for content types to ensure proper interpolation behavior.
Includes new tests to validate the interpolation functionality for multipart requests.
* fix: normalize error handling in sendRequest and improve test reliability
---------
Co-authored-by: Alfonso Presa <alfonso-presa@users.noreply.github.com>
* fix: storing status in example for yml file
* fix: temporary check for tests
* fix: temporary check for tests
* fix: temporary check for tests
* fix: temporary check for tests
* fix: temporary check for tests
* fix: temporary check for tests
* fix: temporary check for tests
* fix: temporary check for tests
* fix: temporary check for tests
* fix: temporary check for tests
* fix: temporary check for tests
* fix: temporary check for tests
* fix: test cases for status and statusText
* chore: removed logs
* fix: test cases for response status and text
* fix: test cases for response status and text
* fix: resolved comments
* fix: openapi test import test cases
* chore: removed console logs
* fix: status type in response example while import/export of collection
* fix: postman to bruno import
---------
Co-authored-by: shubh-bruno <shubh-bruno@shubh-bruno.local>
* Refactor: optimize collection updates with batch processing
- Introduced BatchAggregator to handle IPC events in batches, reducing Redux dispatch overhead during collection mounting.
- Updated collection watcher to utilize batch processing for adding files and directories, improving UI performance.
- Implemented ParsedFileCacheStore using LMDB for efficient caching of parsed file content, enhancing loading speed and reducing redundant parsing.
- Adjusted collection slice to support batch addition of items, minimizing re-renders and improving state management.
- Updated relevant components to reflect changes in loading states and collection data handling.
* feat: add cache management to preferences
- Introduced a new Cache component in the Preferences section to display cache statistics and allow users to purge the cache.
- Implemented IPC handlers for fetching cache stats and purging the cache in the Electron main process.
- Added styled components for better UI presentation of cache information.
- Updated Preferences component to include a new tab for cache management.
* fix: update package-lock.json to change 'devOptional' to 'dev' for several Babel dependencies
* refactor: update batch aggregation parameters for improved performance
- Increased DISPATCH_INTERVAL_MS from 150ms to 200ms for better timing control.
- Adjusted MAX_BATCH_SIZE from 200 to 300 items to enhance batch processing efficiency.
* feat: enhance collection loading state and improve batch aggregator functionality
- Added isLoading property to collections slice to manage loading state during collection operations.
- Updated getAggregator function calls in collection-watcher to include collectionUid for better context in batch processing.
- Normalized directory path handling in parsed-file-cache to ensure consistent prefix creation for cache keys.
* fix: update loading state and transient file handling in collections slice
- Changed isLoading property to false during collection initialization for accurate loading state representation.
- Introduced isTransient flag for directories and files to differentiate between transient and non-transient items.
- Enhanced logic for handling transient directories and files during collection processing to improve state management.
* feat: add batch processing support for file additions in task middleware
- Implemented a new listener for collectionBatchAddItems to handle batch file additions.
- Enhanced task management by checking for pending OPEN_REQUEST tasks that match added files.
- Improved tab management by dispatching addTab actions for matching files and removing corresponding tasks from the queue.
* feat: enable ASAR packaging and unpacking for LMDB binaries in Electron build configuration
- Added ASAR support to the Electron build configuration for the Bruno application.
- Specified unpacking rules for LMDB native binaries to ensure proper loading during runtime.
* feat: implement parsed file cache using IndexedDB for improved performance
- Introduced a new `parsedFileCacheStore` utilizing IndexedDB for caching parsed file data.
- Replaced the previous LMDB-based cache implementation to enhance performance and reliability.
- Updated IPC handlers to manage cache operations such as get, set, invalidate, and clear.
- Integrated the new cache store into various components, ensuring efficient data retrieval and storage.
- Added pruning functionality to remove outdated cache entries on startup.
* refactor: update collection root and item handling to preserve UIDs
- Modified the way collection roots and folder items are assigned by using `mergeRootWithPreservedUids` and `mergeRequestWithPreservedUids` to ensure UIDs are maintained during updates.
- This change enhances data integrity when managing collections and their associated files.
* refactor: pass mainWindow reference to parsedFileCacheStore initialization
- Updated the `initialize` method in `ParsedFileCacheStore` to accept a `mainWindow` parameter, allowing for direct access to the main window instance in IPC handlers.
- This change improves the handling of IPC requests by ensuring the correct window context is used for sending messages.
* refactor: optimize getStats method in parsedFileCacheStore for performance
- Replaced manual counting of total files with a direct count() call for O(1) performance.
- Updated the collection counting logic to utilize openKeyCursor with 'nextunique' for improved efficiency in counting unique collection paths.
- These changes enhance the performance of the getStats method by reducing the complexity of file and collection counting.
* fix: update key generation in parsedFileCache to use newline separator
- Changed the key generation logic in `generateKey` from a null character to a newline character for improved readability and consistency in cache keys.
* refactor: rename batch-aggregator to collection-tree-batcher and add tests
- Rename BatchAggregator class to CollectionTreeBatcher
- Rename getAggregator/removeAggregator to getBatcher/removeBatcher
- Update imports and variable names in collection-watcher.js
- Add backward-compatible aliases for old names
- Add 22 unit tests covering all functionality
* refactor: update key generation in parsedFileCache to use custom separator
- Changed the key generation logic in `generateKey` to use a custom separator (↝) instead of a newline character for improved readability and consistency in cache keys.
* fix: add missing reject handler and fix directory prefix collision
- Add reject to Promise and pendingRequests in parsed-file-cache-idb.js
- Normalize dirPath with trailing separator in invalidateDirectory to
prevent false matches (e.g., /foo/bar matching /foo/barley)
- Use platform-specific path.sep for cross-platform compatibility
* fix: add error handling in parsedFileCache and update window close event
- Added a catch block to handle errors in the database promise in parsedFileCache.
- Updated the window close event listener in collection-tree-batcher to use `once` for better resource management.
* fix: add LRU eviction when IndexedDB quota is exceeded
Handle QuotaExceededError in setEntry by automatically evicting
the oldest 20% of cache entries and retrying the write operation.
* fix: use once instead of on in mock window for batcher tests
---------
Co-authored-by: Chirag Chandrashekhar <cchirag85@gmail.com>
* feat: add options to skip request and response bodies in reporter output
- Introduced `--reporter-skip-request-body` and `--reporter-skip-response-body` flags to omit respective bodies from the reporter output.
- Updated examples in the CLI documentation to reflect new options.
- Refactored result sanitization to handle new flags.
* feat: add shorthand option to skip both request and response bodies in reporter output
- Introduced `--reporter-skip-body` as a shorthand for omitting both request and response bodies from the reporter output.
- Updated CLI documentation examples to include the new shorthand option.
- Adjusted result sanitization to accommodate the new option.
* refactor: simplify documentation and tests for reporter-skip-body option
- Updated the description of the `--reporter-skip-body` option to remove redundancy.
- Removed outdated shorthand references from the test suite for clarity.
- Cleaned up examples in the CLI documentation to focus on the current functionality.
* fix: handle optional chaining for request and response properties in result sanitization
- Updated the `sanitizeResultsForReporter` function to use optional chaining when accessing request and response headers and data.
- This change prevents potential errors when these properties are undefined.
* test: enhance reporter-skip-body tests for JSON and HTML outputs
- Added comprehensive tests for the `--reporter-skip-request-body` and `--reporter-skip-response-body` options in both JSON and HTML report formats.
- Verified that the appropriate request and response bodies are included or excluded based on the specified flags.
- Improved test coverage for scenarios where both flags are used simultaneously.
* fix: remove optional chaining for request and response headers in result sanitization
- Updated the `sanitizeResultsForReporter` function to directly assign empty objects to request and response headers, ensuring consistent behavior regardless of their initial state.
- This change simplifies the code and maintains functionality for skipping headers.
* perf: Improve search performance in code editor
Added cache key to reduce duplicate searches over the complete text.
Added incremental update logic, to not update every marked entry when
clicking "next" or "previous".
Fixes: https://github.com/usebruno/bruno/issues/6913
* Update delimeter to unicode symbol
* fix: skip null query parameters in Postman to Bruno conversion
Updated the importPostmanV2CollectionItem function to skip query parameters where both key and value are null. Added a test case to ensure that such parameters are not included in the converted Bruno collection, while preserving other valid parameters.
* fix: skip null parameters in Postman to Bruno conversion
Updated the importPostmanV2CollectionItem function to skip headers, URL-encoded parameters, and form data where both key and value are null. Added corresponding test cases to ensure proper handling of these scenarios in the conversion process.
* fix: update cursor state handling in CodeEditor for read-only mode
* tests: add response pane update test for re-sent requests
* refactor: add data-testid attributes for improved testing in RequestBody and RequestBodyMode components; update locators and tests accordingly
* test: verify response status code is 200
* test: enhance response pane update tests to verify body editor content after request re-sent
* test: add data-testid for method selector and update locators for improved testability
* fix: openapi cli import
* chore: seperate bru and opencollection by a flag
* fix: pass down format correctly
* fix: pass format option correctly in collection tests
* Add opencollection version for YAML format
Set opencollection version for YAML format.
---------
Co-authored-by: Sid <siddharth@usebruno.com>
* feat: interface zoom control settings
* fix: allow zoom controls using shortcuts
* fix: maintain consitency in zoom shortcuts and ui interface
* fix: added min max to 50% and 150% for zoom
* fix: moved percentageToZoomLevel function in bruno-common
* chore: abstractions
---------
Co-authored-by: shubh-bruno <shubh-bruno@shubh-bruno.local>
* feat: implement workspace collection reordering functionality
feat: add tests and improve collection reordering functionality
fix: handle IPC errors during collection reordering and update tests for persistence validation
refactor: enhance collection reordering logic and update related tests for path consistency
fix: prevent unnecessary promise resolution in collection reordering when no collections are present
* fix: ensure consistent path normalization for workspace collections during reordering