#reqwest see cookies stored in jar

34 messages · Page 1 of 1 (latest)

gloomy cape
#

How do i see the cookies have stored in my jar using:

add_cookie_str();
meager dust
gloomy cape
#

@meager dust ty so much

gloomy cape
#

i cant create an instance or pass it the jar

meager dust
gloomy cape
#

thats the thing

#

i dont have it

#
reqwest = { version = "0.11.22", default-features = false, features = ["rustls-tls", "json", "multipart", "cookies"] }
#

im v confused

meager dust
#

You probably don't have the trait in scope already

gloomy cape
#

yo wtf

#

bruh

meager dust
#

I assume rust analyzer saw it?

gloomy cape
#

yeah ty dude or dudet

#

appreciated!

meager dust
#

Sometimes rust analyzer gets a little confused and doesn't believe a trait is applicable for auto complete

gloomy cape
#

il keep that in mind ty

#

i have been adding my cookies like:

            self.steam_client.cookies.add_cookie_str(
                cookie.value(),
                &"https://buff.163.com"
                    .to_owned()
                    .parse::<reqwest::Url>()
                    .unwrap()
            );
#

and i think they are not correct

#

as they have no name :D

#

now i can just add the headers cookies for each request!

#

wait can i not just pass the headers in and the set_cookies finds the cookies for me? :D

#

by this i mean i cant just pass:

let headers = response.headers();
#

like this:

 self.cookies.set_cookies(headers, &url.to_owned().parse::<reqwest::Url>().unwrap());
meager dust
gloomy cape
#

i am:

    pub async fn new(username: String, password: String) -> Self {
        Self {
            username,
            password,
            client: reqwest::ClientBuilder::new()
                .cookie_store(true)
                .build()
                .unwrap(),
            session_id: Self::_activate_session_id().await,
            cookies: Jar::default(),
        }
    }
#

when i check if i have any cookies using .cookies it says None?

#

its because i need to move the cookies from reallycoolsite.com/path/newpath -> reallycoolsite.com

#

do cookies still get set if you do a post request

meager dust
gloomy cape