How to use Netscape cookie file in reqwest, and follow redirect

I want to convert curl command into Rust code by using reqwest crate. The curl command I am using is:

curl \
    --cookie ~/auth/cookie \
    --cookie-jar ~/auth/cookie \
    -H 'Content-Type: application/json' \
    -d '{"EnvironmentName": "MyEnv"}' \
    -sS \
https://xxxxx.xxxx.com

The ~/auth/cookie cookie file uses Netscape format, and it is recognized by curl command.
When coding my Rust source, I find that it seems no such load_netscape() function in reqwest crate helping loading the cookie file.

I find this https://crates.io/crates/reqwest_cookie_store crate, and it uses json file as cookie file.

Can anyone tell me how to mimic the behavior the curl command doing?

I don't think that crate can parse Netscape cookie files. You can try nescookie instead.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.