hypnotube
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user