Skip to content

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

@sunjiajie

Description

@sunjiajie

Description

When importing a curl command that uses -b (or --cookie) to pass cookies, the parser silently drops both the flag and the cookie value. No error
or warning is shown.

Steps to Reproduce

  1. Copy a curl command with -b flag, e.g.:
    curl 'https://example.com/api/data'
    -b 'session=abc123; token=xyz'
    -H 'accept: application/json'
  2. Import it via the curl import dialog
  3. Observe that cookies are missing from the imported request

Root Cause

In apps/desktop/src-tauri/src/http/curl.rs, the parse_curl() match block does not handle -b / --cookie. The flag hits the default _ branch
and is skipped. The following token (cookie value) is also silently consumed or ignored.

Expected Behavior

Cookies from -b / --cookie should be parsed and imported — either as a Cookie header or into the cookie management system (#29, #40).

Suggested Fix

Add a match arm in parse_curl():

"-b" | "--cookie" => {                                                                                                                              
 if let Some(cookie_val) = iter.next() {                              
     headers.insert("Cookie".to_string(), cookie_val.clone());
 }                                                                                                                                                  
}
                                                                                                                                                    
Related                                                               
                                             
- #39 (curl import)                                                                                                                                 
- #40 (cookie management)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions