Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
tancred committed Apr 10, 2024
1 parent b8eab81 commit 2b66795
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/actions/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use async_trait::async_trait;
use colored::Colorize;
use reqwest::{
header::{self, HeaderMap, HeaderName, HeaderValue},
ClientBuilder, Method, Response, redirect::Policy
redirect::Policy,
ClientBuilder, Method, Response,
};
use std::fmt::Write;
use url::Url;
Expand Down Expand Up @@ -173,11 +174,15 @@ impl Request {

if let Some(cookies) = context.get("cookies") {
let cookies: Map<String, Value> = serde_json::from_value(cookies.clone()).unwrap();
let cookie = cookies.iter().map(|(key, value)| {
let v = value.to_string();
let trimmedval = v.trim_matches('"');
format!("{key}={trimmedval}")
}).collect::<Vec<_>>().join(";");
let cookie = cookies
.iter()
.map(|(key, value)| {
let v = value.to_string();
let trimmedval = v.trim_matches('"');
format!("{key}={trimmedval}")
})
.collect::<Vec<_>>()
.join(";");

headers.insert(header::COOKIE, HeaderValue::from_str(&cookie).unwrap());
}
Expand Down

0 comments on commit 2b66795

Please sign in to comment.