Skip to content

Fix: ensure string authvalues, string header processing - #7646

Merged
bijin-bruno merged 9 commits into
usebruno:mainfrom
sanish-bruno:fix/ensure-string-authvalues
Apr 1, 2026
Merged

bijin-bruno merged 9 commits into
usebruno:mainfrom
sanish-bruno:fix/ensure-string-authvalues

Conversation

@sanish-bruno

@sanish-bruno sanish-bruno commented Apr 1, 2026 •

Copy link
Copy Markdown
Collaborator

Jira

Description

Extends the Postman import robustness (follow-up to #7644) with auth field coercion, string header support, and improved ensureString fallback handling.

Changes

1. Auth field coercion in processAuth()

  • Replaced || '' / ?.toString() with ensureString() across all auth types (Basic, Bearer, AWSV4, API Key, Digest, OAuth1, OAuth2)
  • Auth fields in Bruno's Yup schema use Yup.string().nullable() with .strict(), so non-string values from Postman would cause schema validation failures
  • OAuth1 nullable fields use ensureString(value, null) to preserve null fallback
  • OAuth1 fields with defaults (e.g. signatureMethod, version) use ensureString(value, 'HMAC-SHA1') to preserve default behavior

2. String header support via normalizeHeaders()

  • Postman's v2.1 schema allows headers as: array of objects, array with mixed string/object items, single concatenated string ("Key: Value\r\nKey2: Value2"), or null
  • Added parseStringHeader() — parses "Key: Value" format (uses indexOf(':') to handle values containing colons)
  • Added normalizeHeaders() — normalizes all header formats into an array of objects
  • Applied at all 5 header processing sites: request headers, example request/response headers, searchLanguageByHeader(), getBodyTypeFromContentTypeHeader()

3. Improved ensureString fallback handling

  • Added fallback parameter: ensureString(value, fallback = '')
  • Empty strings now trigger fallback (matches original || fallback behavior for fields with meaningful defaults)

Tests added

  • Numeric values in request fields (headers, query, path, urlencoded, multipart)
  • Numeric values in example request/response fields
  • String headers in arrays (mixed with objects)
  • Concatenated string header field
  • String header with no value

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.

Summary by CodeRabbit

  • Bug Fixes

    • Coerce numeric and other non-string Postman values into strings across headers, query/path params, form fields, auth values, and examples.
    • Handle varied Postman header inputs (arrays, objects, or concatenated CRLF strings) consistently.
  • Refactor

    • Normalize header and parameter handling into a safer, unified conversion flow.
  • Tests

    • Added tests covering numeric→string normalization and multiple header format scenarios.
  • Chore

    • Tightened lint rule configuration for converter files.

… Postman to Bruno conversion

- Introduced `ensureString` function to convert numeric and non-string values to strings, defaulting null/undefined to an empty string.
- Updated request handling in `importPostmanV2CollectionItem` to utilize `ensureString` for headers, parameters, and body fields.
- Added tests to verify correct conversion of numeric values to strings in headers, query parameters, and body fields.
…formation

- Implemented a new test case to verify that numeric values in example request and response fields are correctly converted to strings during the Postman to Bruno conversion process.
- The test checks various components including request headers, query parameters, path parameters, and body fields to ensure proper string conversion.
… to Bruno transformation

- Added a new test case to verify that numeric values in multipart form data are correctly converted to strings during the Postman to Bruno conversion process.
- The test checks the conversion of numeric values in the request body to ensure proper handling in the transformation.
- Added `parseStringHeader` and `normalizeHeaders` functions to handle various header formats, including string headers and concatenated strings.
- Updated the request and response handling in `importPostmanV2CollectionItem` to utilize the new header normalization logic.
- Introduced tests to verify correct parsing of string headers, including cases with no values and concatenated headers.
@coderabbitai

coderabbitai Bot commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

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: 9d61dda4-165b-48b4-9519-1bba023f3673

📥 Commits

Reviewing files that changed from the base of the PR and between 8fb53ef and 75e59c8.

📒 Files selected for processing (1)
  • eslint.config.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • eslint.config.js

Walkthrough

Adds string-coercion and header-normalization helpers to the Postman→Bruno converter and applies them across auth, headers, params, multipart/form, and examples so non-string Postman values are consistently converted to Bruno strings.

Changes

Cohort / File(s) Summary
Converter logic
packages/bruno-converters/src/postman/postman-to-bruno.js
Added ensureString, parseStringHeader, normalizeHeaders. Replaced ad-hoc `
Tests
packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js
Added tests asserting numeric→string coercion for headers, query/path params, urlencoded/multipart body fields and examples. Added tests for header parsing from arrays, CRLF-concatenated strings, and name-only header strings.
Lint config
eslint.config.js
Enabled core no-case-declarations as an error for packages/bruno-converters/**/*.js scope.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

Suggested reviewers

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

Poem

Numbers slip into quotes without a fight,
Headers harmonize and values turn polite.
Postman hands Bruno strings, neat and bright,
Parsers nod, converters hum — all right. 🎉

🚥 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 references the main changes: ensuring auth values are strings and improving header processing, which aligns with the primary modifications across the converter and test 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

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.

- Updated the `ensureString` function to accept a fallback parameter, allowing for customizable default values instead of a fixed empty string for null/undefined inputs.
- Modified the usage of `ensureString` in the `processAuth` function to utilize the new fallback feature for various authentication fields, improving the handling of optional values.
- Modified the `ensureString` function to return the fallback for null, undefined, or empty string values, enhancing its flexibility in handling various input scenarios.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (1)
packages/bruno-converters/src/postman/postman-to-bruno.js (1)

299-357: ⚠️ Potential issue | 🟠 Major

Wrap the OAuth2 case body in braces.

The case AUTH_TYPES.OAUTH2: at line 298 contains multiple lexical declarations (const findValueUsingKey, const oauth2GrantTypeMaps, etc.) directly in the case body. Biome's noSwitchDeclarations rule forbids this—lexical declarations in switch cases are hoisted to the entire switch scope, risking uninitialized access from other cases. Wrapping the case body in braces limits scope to that case only.

Suggested fix
    case AUTH_TYPES.OAUTH2:
+   {
      const findValueUsingKey = (key) => ensureString(authValues[key]);

      // Maps Postman's grant_type to the Bruno's grantType string expected in the target object
      const oauth2GrantTypeMaps = {
        authorization_code_with_pkce: 'authorization_code',
        authorization_code: 'authorization_code',
        client_credentials: 'client_credentials',
        password_credentials: 'password'
      };

      // ... rest of case body ...

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

In `@packages/bruno-converters/src/postman/postman-to-bruno.js` around lines 299 -
357, The OAuth2 case (case AUTH_TYPES.OAUTH2) declares lexical variables like
findValueUsingKey, oauth2GrantTypeMaps and baseOAuth2Config directly in the
switch case which violates noSwitchDeclarations; wrap the entire case body in
its own block (add opening and closing braces immediately after the case label)
so those consts are scoped to that case only, keeping the switch structure and
all uses of requestObject.auth.oauth2, findValueUsingKey, oauth2GrantTypeMaps
and baseOAuth2Config unchanged.
🤖 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-converters/src/postman/postman-to-bruno.js`:
- Around line 824-831: The code in postman-to-bruno.js uses
contentTypeHeader.value?.toLowerCase() without ensuring the header value is a
string, which throws for non-string values (e.g., 0); update the logic in the
block that finds contentTypeHeader (after normalizeHeaders) to coerce or guard
the value before calling toLowerCase (for example, check typeof
contentTypeHeader.value === 'string' or cast with String(contentTypeHeader.value
|| '')), mirror the pattern used in searchLanguageByHeader(), and ensure that if
coercion/guarding fails you fall back to returning 'text'.

In
`@packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js`:
- Around line 819-972: Add two tests in the same spec (near the numeric-value
tests) that cover auth stringification by calling postmanToBruno with (1) an
array-backed auth in a request (e.g., request.auth as [{ key: 'token', value:
123 }]) and (2) an object-backed auth in an example/originalRequest (e.g.,
request.auth as { apiKey: { key: 'key', value: 456 } }), then assert that
brunoCollection.items[n].request.auth (and example.request.auth where
applicable) contains stringified values ('123', '456') to cover both auth
translators; place assertions alongside the existing checks for
headers/params/body and reuse the pattern of inspecting brunoCollection.items
and brunoCollection.items[0].examples[0] to locate converted auth fields.

---

Outside diff comments:
In `@packages/bruno-converters/src/postman/postman-to-bruno.js`:
- Around line 299-357: The OAuth2 case (case AUTH_TYPES.OAUTH2) declares lexical
variables like findValueUsingKey, oauth2GrantTypeMaps and baseOAuth2Config
directly in the switch case which violates noSwitchDeclarations; wrap the entire
case body in its own block (add opening and closing braces immediately after the
case label) so those consts are scoped to that case only, keeping the switch
structure and all uses of requestObject.auth.oauth2, findValueUsingKey,
oauth2GrantTypeMaps and baseOAuth2Config unchanged.
🪄 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: c8359e85-9f98-474a-9d97-9fea1878ff6b

📥 Commits

Reviewing files that changed from the base of the PR and between 28d1ba2 and 7be4aec.

📒 Files selected for processing (2)
  • packages/bruno-converters/src/postman/postman-to-bruno.js
  • packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/bruno-converters/src/postman/postman-to-bruno.js (1)

810-812: ⚠️ Potential issue | 🟠 Major

Still lowercasing raw Content-Type fields.

Both helper paths call .toLowerCase() on header.key / header.value before ensureString(...). Inputs like { key: 'Content-Type', value: 0 } still throw here, so the import can fail on the exact mixed-value scenario this PR is targeting.

🐛 Suggested fix
 const searchLanguageByHeader = (headers) => {
   let contentType;
   each(normalizeHeaders(headers), (header) => {
-    if (header.key?.toLowerCase() === 'content-type' && !header.disabled) {
-      if (typeof header.value == 'string' && /^[\w\-]+\/([\w\-]+\+)?json/.test(header.value)) {
+    const headerKey = ensureString(header?.key).toLowerCase();
+    const headerValue = ensureString(header?.value).toLowerCase();
+    if (headerKey === 'content-type' && !header?.disabled) {
+      if (/^[\w\-]+\/([\w\-]+\+)?json/.test(headerValue)) {
         contentType = 'json';
-      } else if (typeof header.value == 'string' && /^[\w\-]+\/([\w\-]+\+)?xml/.test(header.value)) {
+      } else if (/^[\w\-]+\/([\w\-]+\+)?xml/.test(headerValue)) {
         contentType = 'xml';
       }
       return false;
@@
-  const contentTypeHeader = normalizedHeaders.find((header) => header.key?.toLowerCase() === 'content-type');
+  const contentTypeHeader = normalizedHeaders.find((header) => ensureString(header?.key).toLowerCase() === 'content-type');
   if (contentTypeHeader) {
-    const contentType = contentTypeHeader.value?.toLowerCase();
+    const contentType = ensureString(contentTypeHeader?.value).toLowerCase();

Also applies to: 829-831

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

In `@packages/bruno-converters/src/postman/postman-to-bruno.js` around lines 810 -
812, The code is lowercasing header.key and header.value before converting them
to strings, which crashes for non-string values (e.g., {key: 'Content-Type',
value: 0}); change the checks in the normalizeHeaders iteration to first coerce
via ensureString (or a safe string conversion) and then run .toLowerCase() or
the regex test on that coerced string; specifically, use
ensureString(header.key) before calling .toLowerCase() when checking the key and
use ensureString(header.value) (or cast to string) before applying the
/^[\w\-]+\/([\w\-]+\+)?json/ regex, and apply the same fix to the other
occurrence around lines 829-831 so both paths no longer call .toLowerCase() on
potentially non-string header fields.
🧹 Nitpick comments (1)
packages/bruno-converters/src/postman/postman-to-bruno.js (1)

542-545: Avoid lossy join('') for multipart array values.

This collapses ['a', 'b'] into ab, which is not reversible and doesn't match the ensureString(...) behavior used for the other converted fields. Reusing the same helper in both request and example paths keeps the coercion consistent.

♻️ Consistent coercion
-              : (Array.isArray(param.value) ? param.value.join('') : ensureString(param.value));
+              : ensureString(param.value);
@@
-                    : (Array.isArray(param.value) ? param.value.join('') : ensureString(param.value));
+                    : ensureString(param.value);

Also applies to: 738-740

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

In `@packages/bruno-converters/src/postman/postman-to-bruno.js` around lines 542 -
545, The multipart param coercion currently collapses arrays via join('') which
is lossy; change the assignment that computes value (the const value in
postman-to-bruno.js) to preserve array elements by applying ensureString to each
element instead of joining, i.e. when Array.isArray(param.value) return
param.value.map(ensureString), and leave the non-array branch as
ensureString(param.value); make the same change in the other occurrence noted
(around the 738–740 area) so both request and example paths use ensureString
consistently.
🤖 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-converters/src/postman/postman-to-bruno.js`:
- Around line 298-300: The OAuth2 switch branch declares multiple variables and
a nested switch which violates the noSwitchDeclarations rule; wrap the entire
case AUTH_TYPES.OAUTH2: body in a block (add { ... } immediately after the case
and before the break) so declarations like findValueUsingKey,
oauth2GrantTypeMaps, postmanGrantType, targetGrantType, and baseOAuth2Config and
the nested switch are scoped inside the braces and no longer exist as top-level
switch declarations.

---

Duplicate comments:
In `@packages/bruno-converters/src/postman/postman-to-bruno.js`:
- Around line 810-812: The code is lowercasing header.key and header.value
before converting them to strings, which crashes for non-string values (e.g.,
{key: 'Content-Type', value: 0}); change the checks in the normalizeHeaders
iteration to first coerce via ensureString (or a safe string conversion) and
then run .toLowerCase() or the regex test on that coerced string; specifically,
use ensureString(header.key) before calling .toLowerCase() when checking the key
and use ensureString(header.value) (or cast to string) before applying the
/^[\w\-]+\/([\w\-]+\+)?json/ regex, and apply the same fix to the other
occurrence around lines 829-831 so both paths no longer call .toLowerCase() on
potentially non-string header fields.

---

Nitpick comments:
In `@packages/bruno-converters/src/postman/postman-to-bruno.js`:
- Around line 542-545: The multipart param coercion currently collapses arrays
via join('') which is lossy; change the assignment that computes value (the
const value in postman-to-bruno.js) to preserve array elements by applying
ensureString to each element instead of joining, i.e. when
Array.isArray(param.value) return param.value.map(ensureString), and leave the
non-array branch as ensureString(param.value); make the same change in the other
occurrence noted (around the 738–740 area) so both request and example paths use
ensureString consistently.
🪄 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: fbb5accc-be6e-4d35-9cbb-66c863efcff8

📥 Commits

Reviewing files that changed from the base of the PR and between 7be4aec and 55c3f87.

📒 Files selected for processing (1)
  • packages/bruno-converters/src/postman/postman-to-bruno.js

…rsion tests

- Added 'no-case-declarations' rule to ESLint configuration to enforce stricter coding standards.
- Modified the `processAuth` function to ensure proper block scoping for OAuth2 case handling.
- Improved header parsing logic to check for string type in content-type header.
- Added new tests to verify conversion of numeric authentication values to strings in both array-backed and object-backed formats during Postman to Bruno transformation.
@pull-request-size pull-request-size Bot added size/XL and removed size/L labels Apr 1, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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)
packages/bruno-converters/src/postman/postman-to-bruno.js (1)

809-842: ⚠️ Potential issue | 🟡 Minor

Numeric header.key can still throw on toLowerCase().

Lines 812 and 830 use header.key?.toLowerCase(). Optional chaining guards against null/undefined but not numeric keys. If a Postman collection has { key: 123, value: 'application/json' }, this will throw TypeError: 123.toLowerCase is not a function.

The value handling was fixed (line 813 and 831 check typeof ... === 'string'), but the key comparison needs the same treatment or ensureString() coercion.

🛠️ Suggested fix
 const searchLanguageByHeader = (headers) => {
   let contentType;
   each(normalizeHeaders(headers), (header) => {
-    if (header.key?.toLowerCase() === 'content-type' && !header.disabled) {
+    if (typeof header.key === 'string' && header.key.toLowerCase() === 'content-type' && !header.disabled) {
       if (typeof header.value == 'string' && /^[\w\-]+\/([\w\-]+\+)?json/.test(header.value)) {
 const getBodyTypeFromContentTypeHeader = (headers) => {
   const normalizedHeaders = normalizeHeaders(headers);
   if (!normalizedHeaders.length) {
     return 'text';
   }

-  const contentTypeHeader = normalizedHeaders.find((header) => header.key?.toLowerCase() === 'content-type');
+  const contentTypeHeader = normalizedHeaders.find((header) => typeof header.key === 'string' && header.key.toLowerCase() === 'content-type');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-converters/src/postman/postman-to-bruno.js` around lines 809 -
842, Both searchLanguageByHeader and getBodyTypeFromContentTypeHeader call
header.key?.toLowerCase(), which will throw if header.key is a non-string (e.g.,
numeric); update these checks to ensure header.key is a string before calling
toLowerCase (for example, check typeof header.key === 'string' &&
header.key.toLowerCase() === 'content-type') or coerce safely with
String(header.key).toLowerCase() when locating the Content-Type header
(affecting the header iteration in searchLanguageByHeader and the
contentTypeHeader find in getBodyTypeFromContentTypeHeader).
🤖 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 `@packages/bruno-converters/src/postman/postman-to-bruno.js`:
- Around line 809-842: Both searchLanguageByHeader and
getBodyTypeFromContentTypeHeader call header.key?.toLowerCase(), which will
throw if header.key is a non-string (e.g., numeric); update these checks to
ensure header.key is a string before calling toLowerCase (for example, check
typeof header.key === 'string' && header.key.toLowerCase() === 'content-type')
or coerce safely with String(header.key).toLowerCase() when locating the
Content-Type header (affecting the header iteration in searchLanguageByHeader
and the contentTypeHeader find in getBodyTypeFromContentTypeHeader).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c9d904a5-35db-42a7-b61e-fbf6e5a8238a

📥 Commits

Reviewing files that changed from the base of the PR and between 55c3f87 and 8fb53ef.

📒 Files selected for processing (3)
  • eslint.config.js
  • packages/bruno-converters/src/postman/postman-to-bruno.js
  • packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js

- Added 'no-case-declarations' rule to ESLint configuration to enhance code quality.
- Adjusted existing rules for consistency and clarity in the configuration.
bijin-bruno
bijin-bruno previously approved these changes Apr 1, 2026
@bijin-bruno
bijin-bruno merged commit c7ebe25 into usebruno:main Apr 1, 2026
10 checks passed
lohit-bruno pushed a commit to lohit-bruno/bruno that referenced this pull request Apr 1, 2026
* feat: add helper to ensure string conversion for non-string values in Postman to Bruno conversion

- Introduced `ensureString` function to convert numeric and non-string values to strings, defaulting null/undefined to an empty string.
- Updated request handling in `importPostmanV2CollectionItem` to utilize `ensureString` for headers, parameters, and body fields.
- Added tests to verify correct conversion of numeric values to strings in headers, query parameters, and body fields.

* test: add test for numeric value conversion in Postman to Bruno transformation

- Implemented a new test case to verify that numeric values in example request and response fields are correctly converted to strings during the Postman to Bruno conversion process.
- The test checks various components including request headers, query parameters, path parameters, and body fields to ensure proper string conversion.

* test: add multipart form value test for numeric conversion in Postman to Bruno transformation

- Added a new test case to verify that numeric values in multipart form data are correctly converted to strings during the Postman to Bruno conversion process.
- The test checks the conversion of numeric values in the request body to ensure proper handling in the transformation.

* feat: enhance header parsing in Postman to Bruno conversion

- Added `parseStringHeader` and `normalizeHeaders` functions to handle various header formats, including string headers and concatenated strings.
- Updated the request and response handling in `importPostmanV2CollectionItem` to utilize the new header normalization logic.
- Introduced tests to verify correct parsing of string headers, including cases with no values and concatenated headers.

* refactor: enhance ensureString function for flexible fallback values

- Updated the `ensureString` function to accept a fallback parameter, allowing for customizable default values instead of a fixed empty string for null/undefined inputs.
- Modified the usage of `ensureString` in the `processAuth` function to utilize the new fallback feature for various authentication fields, improving the handling of optional values.

* refactor: update ensureString function to handle empty values

- Modified the `ensureString` function to return the fallback for null, undefined, or empty string values, enhancing its flexibility in handling various input scenarios.

* chore: update ESLint configuration and enhance Postman to Bruno conversion tests

- Added 'no-case-declarations' rule to ESLint configuration to enforce stricter coding standards.
- Modified the `processAuth` function to ensure proper block scoping for OAuth2 case handling.
- Improved header parsing logic to check for string type in content-type header.
- Added new tests to verify conversion of numeric authentication values to strings in both array-backed and object-backed formats during Postman to Bruno transformation.

* chore: update ESLint configuration to enforce stricter rules

- Added 'no-case-declarations' rule to ESLint configuration to enhance code quality.
- Adjusted existing rules for consistency and clarity in the configuration.

---------

Co-authored-by: Bijin A B <[email protected]>
lohit-bruno pushed a commit that referenced this pull request Apr 3, 2026
* feat: add helper to ensure string conversion for non-string values in Postman to Bruno conversion

- Introduced `ensureString` function to convert numeric and non-string values to strings, defaulting null/undefined to an empty string.
- Updated request handling in `importPostmanV2CollectionItem` to utilize `ensureString` for headers, parameters, and body fields.
- Added tests to verify correct conversion of numeric values to strings in headers, query parameters, and body fields.

* test: add test for numeric value conversion in Postman to Bruno transformation

- Implemented a new test case to verify that numeric values in example request and response fields are correctly converted to strings during the Postman to Bruno conversion process.
- The test checks various components including request headers, query parameters, path parameters, and body fields to ensure proper string conversion.

* test: add multipart form value test for numeric conversion in Postman to Bruno transformation

- Added a new test case to verify that numeric values in multipart form data are correctly converted to strings during the Postman to Bruno conversion process.
- The test checks the conversion of numeric values in the request body to ensure proper handling in the transformation.

* feat: enhance header parsing in Postman to Bruno conversion

- Added `parseStringHeader` and `normalizeHeaders` functions to handle various header formats, including string headers and concatenated strings.
- Updated the request and response handling in `importPostmanV2CollectionItem` to utilize the new header normalization logic.
- Introduced tests to verify correct parsing of string headers, including cases with no values and concatenated headers.

* refactor: enhance ensureString function for flexible fallback values

- Updated the `ensureString` function to accept a fallback parameter, allowing for customizable default values instead of a fixed empty string for null/undefined inputs.
- Modified the usage of `ensureString` in the `processAuth` function to utilize the new fallback feature for various authentication fields, improving the handling of optional values.

* refactor: update ensureString function to handle empty values

- Modified the `ensureString` function to return the fallback for null, undefined, or empty string values, enhancing its flexibility in handling various input scenarios.

* chore: update ESLint configuration and enhance Postman to Bruno conversion tests

- Added 'no-case-declarations' rule to ESLint configuration to enforce stricter coding standards.
- Modified the `processAuth` function to ensure proper block scoping for OAuth2 case handling.
- Improved header parsing logic to check for string type in content-type header.
- Added new tests to verify conversion of numeric authentication values to strings in both array-backed and object-backed formats during Postman to Bruno transformation.

* chore: update ESLint configuration to enforce stricter rules

- Added 'no-case-declarations' rule to ESLint configuration to enhance code quality.
- Adjusted existing rules for consistency and clarity in the configuration.

---------

Co-authored-by: Bijin A B <[email protected]>
maxenceleblanc pushed a commit to maxenceleblanc/curly_cats2 that referenced this pull request Jul 20, 2026
* feat: add helper to ensure string conversion for non-string values in Postman to Bruno conversion

- Introduced `ensureString` function to convert numeric and non-string values to strings, defaulting null/undefined to an empty string.
- Updated request handling in `importPostmanV2CollectionItem` to utilize `ensureString` for headers, parameters, and body fields.
- Added tests to verify correct conversion of numeric values to strings in headers, query parameters, and body fields.

* test: add test for numeric value conversion in Postman to Bruno transformation

- Implemented a new test case to verify that numeric values in example request and response fields are correctly converted to strings during the Postman to Bruno conversion process.
- The test checks various components including request headers, query parameters, path parameters, and body fields to ensure proper string conversion.

* test: add multipart form value test for numeric conversion in Postman to Bruno transformation

- Added a new test case to verify that numeric values in multipart form data are correctly converted to strings during the Postman to Bruno conversion process.
- The test checks the conversion of numeric values in the request body to ensure proper handling in the transformation.

* feat: enhance header parsing in Postman to Bruno conversion

- Added `parseStringHeader` and `normalizeHeaders` functions to handle various header formats, including string headers and concatenated strings.
- Updated the request and response handling in `importPostmanV2CollectionItem` to utilize the new header normalization logic.
- Introduced tests to verify correct parsing of string headers, including cases with no values and concatenated headers.

* refactor: enhance ensureString function for flexible fallback values

- Updated the `ensureString` function to accept a fallback parameter, allowing for customizable default values instead of a fixed empty string for null/undefined inputs.
- Modified the usage of `ensureString` in the `processAuth` function to utilize the new fallback feature for various authentication fields, improving the handling of optional values.

* refactor: update ensureString function to handle empty values

- Modified the `ensureString` function to return the fallback for null, undefined, or empty string values, enhancing its flexibility in handling various input scenarios.

* chore: update ESLint configuration and enhance Postman to Bruno conversion tests

- Added 'no-case-declarations' rule to ESLint configuration to enforce stricter coding standards.
- Modified the `processAuth` function to ensure proper block scoping for OAuth2 case handling.
- Improved header parsing logic to check for string type in content-type header.
- Added new tests to verify conversion of numeric authentication values to strings in both array-backed and object-backed formats during Postman to Bruno transformation.

* chore: update ESLint configuration to enforce stricter rules

- Added 'no-case-declarations' rule to ESLint configuration to enhance code quality.
- Adjusted existing rules for consistency and clarity in the configuration.

---------

Co-authored-by: Bijin A B <[email protected]>
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.

2 participants