Skip to content

fix(curl): parse -b/--cookie flag as Cookie header#81

Open
diegoQuinas wants to merge 2 commits into
berbicanes:mainfrom
diegoQuinas:fix/66-curl-cookie-flag
Open

fix(curl): parse -b/--cookie flag as Cookie header#81
diegoQuinas wants to merge 2 commits into
berbicanes:mainfrom
diegoQuinas:fix/66-curl-cookie-flag

Conversation

@diegoQuinas
Copy link
Copy Markdown

Problem

When importing a curl command that uses -b or --cookie, the flag and its value were silently dropped. No error was shown. Closes #66.

Root Cause

In parse_curl() (apps/desktop/src-tauri/src/http/curl.rs), the -b/--cookie flag hit the _ => catch-all, which skipped the flag but left the cookie value to be mishandled by the next loop iteration.

Fix

Added a match arm that consumes the next token and inserts it as a Cookie header — consistent with how -H, -d, and -u are handled.

Testing

Added two unit tests: one for -b (short form) and one for --cookie (long form). All 6 curl unit tests pass.

cd apps/desktop/src-tauri && cargo test http::curl
# test result: ok. 6 passed; 0 failed

Fixes berbicanes#66

The -b / --cookie flag was hitting the unknown-flag catch-all and
being silently dropped along with its value. Added a match arm that
reads the next token and inserts it as a Cookie header, consistent
with how other value-consuming flags (-H, -d, -u) are handled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

curl import: -b / --cookie flag not recognized, cookies silently dropped

1 participant