[PR #5911] fix(curl): strip output control flags during cURL import #5414

Open
opened 2026-03-17 02:51:46 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5911
Author: @chhaviG22
Created: 2/26/2026
Status: 🔄 Open

Base: mainHead: fix/curl-import-issue


📝 Commits (2)

  • 58638e1 fix(curl): strip output control flags during cURL import
  • 0276569 Update packages/hoppscotch-common/src/helpers/curl/sub_helpers/preproc.ts

📊 Changes

2 files changed (+85 additions, -1 deletions)

View changed files

📝 packages/hoppscotch-common/src/helpers/curl/__tests__/curlparser.spec.js (+24 -0)
📝 packages/hoppscotch-common/src/helpers/curl/sub_helpers/preproc.ts (+61 -1)

📄 Description

Closes #5910

This PR fixes a bug where cURL commands containing output control flags (e.g., -sS, -v) fail to import, even though these flags don't affect the actual HTTP request.

Problem

Many API documentation examples use cURL flags like -sS (silent + show-error) or -v (verbose) to control output behavior.

Example that currently fails:
curl -sS "https://api.example.com/users" --user "demo_user:demo_pass"

What's changed

[x] Add removeCurlOutputFlags() function to strip output-only flags during preprocessing
[x] Strip flags: -s, -S, -v, -i, -sS, -sSv, --silent, --show-error, --verbose, etc.
[x] Preserve all request-affecting flags (-X, -H, -d, -u, etc.)
[x] Add test case verifying -sS flag with basic auth

Notes to reviewers


Summary by cubic

Fixes cURL import failures by stripping output-only flags during preprocessing. Flags are removed only outside quotes so request data stays intact, including quoted and escaped content.

  • Bug Fixes
    • Remove display-only flags: -s, -S, -v, -i; combined short groups (-sS, -sv, -sSv); and --silent, --show-error, --verbose, --include, --progress-bar, --no-progress-meter.
    • Preserve request-affecting flags (-X, -H, -d, -u, -I, -G, etc.). Added a test for -sS with Basic Auth and quoted credentials.

Written for commit 02765693c5. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5911 **Author:** [@chhaviG22](https://github.com/chhaviG22) **Created:** 2/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/curl-import-issue` --- ### 📝 Commits (2) - [`58638e1`](https://github.com/hoppscotch/hoppscotch/commit/58638e13e0df4cfb22ee7be79d370f676b0cabd0) fix(curl): strip output control flags during cURL import - [`0276569`](https://github.com/hoppscotch/hoppscotch/commit/02765693c50a505633858c4a6ba406ec5d580700) Update packages/hoppscotch-common/src/helpers/curl/sub_helpers/preproc.ts ### 📊 Changes **2 files changed** (+85 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/helpers/curl/__tests__/curlparser.spec.js` (+24 -0) 📝 `packages/hoppscotch-common/src/helpers/curl/sub_helpers/preproc.ts` (+61 -1) </details> ### 📄 Description Closes #5910 This PR fixes a bug where cURL commands containing output control flags (e.g., `-sS`, `-v`) fail to import, even though these flags don't affect the actual HTTP request. ### Problem Many API documentation examples use cURL flags like `-sS` (silent + show-error) or `-v` (verbose) to control output behavior. **Example that currently fails:** curl -sS "https://api.example.com/users" --user "demo_user:demo_pass" ### What's changed [x] Add removeCurlOutputFlags() function to strip output-only flags during preprocessing [x] Strip flags: -s, -S, -v, -i, -sS, -sSv, --silent, --show-error, --verbose, etc. [x] Preserve all request-affecting flags (-X, -H, -d, -u, etc.) [x] Add test case verifying -sS flag with basic auth <!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - [ ] Not Completed - [x] Completed --> ### Notes to reviewers <!-- Any information you feel the reviewer should know about when reviewing your PR --> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes cURL import failures by stripping output-only flags during preprocessing. Flags are removed only outside quotes so request data stays intact, including quoted and escaped content. - **Bug Fixes** - Remove display-only flags: -s, -S, -v, -i; combined short groups (-sS, -sv, -sSv); and --silent, --show-error, --verbose, --include, --progress-bar, --no-progress-meter. - Preserve request-affecting flags (-X, -H, -d, -u, -I, -G, etc.). Added a test for -sS with Basic Auth and quoted credentials. <sup>Written for commit 02765693c50a505633858c4a6ba406ec5d580700. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5414
No description provided.