hypnotube

This commit is contained in:
Simon
2026-01-10 18:29:29 +00:00
parent eb49998593
commit aaff7d00c6
4 changed files with 444 additions and 2 deletions

View File

@@ -111,7 +111,7 @@ impl Requester {
request.send().await
}
pub async fn post<S>(
pub async fn post_json<S>(
&mut self,
url: &str,
data: &S,
@@ -137,6 +137,29 @@ impl Requester {
request.send().await
}
pub async fn post(
&mut self,
url: &str,
data: &str,
headers: Vec<(&str, &str)>,
) -> Result<Response, wreq::Error> {
let mut request = self.client.post(url).version(Version::HTTP_11).body(data.to_string());
// Set custom headers
for (key, value) in headers.iter() {
request = request.header(key.to_string(), value.to_string());
}
if self.proxy {
if let Ok(proxy_url) = env::var("BURP_URL") {
let proxy = Proxy::all(&proxy_url).unwrap();
request = request.proxy(proxy);
}
}
request.send().await
}
pub async fn post_multipart(
&mut self,
url: &str,