mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[PR #5914] [CLOSED] fix(curl): handle output-control flags in curl import #5415
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5415
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5914
Author: @A386official
Created: 2/28/2026
Status: ❌ Closed
Base:
main← Head:fix/curl-import-output-flags📝 Commits (2)
23d21f4fix(curl): handle output-control flags in curl importf4c54eefix(curlparser): add -G and long-form boolean flags📊 Changes
2 files changed (+139 additions, -1 deletions)
View changed files
📝
packages/hoppscotch-common/src/helpers/curl/__tests__/curlparser.spec.js(+102 -0)📝
packages/hoppscotch-common/src/helpers/curl/curlparser.ts(+37 -1)📄 Description
Fixes #5910
What's going on
When you paste a curl command with flags like
-sS,-v, or-k, the import fails with "cURL is not formatted properly". This happens becauseyargs-parserdoesn't know these are boolean flags, so it treats the next argument as their value. If that next argument is the URL, it gets swallowed and the parser can't find it.For example,
curl -sS https://example.comgets parsed as:The URL ends up as the value of
-Sinstead of in the positional args wheregetURLObjectlooks for it.Fix
Pass a
booleanconfig toyargs-parserlisting the curl flags that don't take arguments:-s,-S,-v,-k,-L,-N,-f,-q,-n,-#,-0,-4,-6These are all output/behavior flags that don't affect the HTTP request itself. After the fix:
Tests
Added 3 test cases:
curl -sS <url>(the exact case from the issue)curl -sSL -k -H '...' <url>(combined flags with headers)curl -v <url>(verbose flag)All 32 tests pass (29 existing + 3 new).
Summary by cubic
Fixes curl import failures by treating non-argument flags (short and long) as booleans so the URL isn’t swallowed. This resolves “cURL is not formatted properly” for commands using combined flags like -sS, -v, -k, -G, -I, and their long forms.
Written for commit
f4c54eeffb. Summary will update on new commits.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.