chore: return request builder

This commit is contained in:
əlemi 2023-06-21 00:23:12 +02:00
parent 2bca7b8581
commit aa13cfac10
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -13,17 +13,17 @@ fn fill_from_env(mut txt: String) -> String {
}
pub trait IntoRequest {
fn make_request(&self) -> reqwest::Request;
fn make_request(&self) -> reqwest::RequestBuilder;
}
impl IntoRequest for v2_0_0::RequestClass {
fn make_request(&self) -> reqwest::Request {
fn make_request(&self) -> reqwest::RequestBuilder {
todo!()
}
}
impl IntoRequest for v2_1_0::RequestClass {
fn make_request(&self) -> reqwest::Request {
fn make_request(&self) -> reqwest::RequestBuilder {
let method = reqwest::Method::from_bytes(
&self.method.as_ref().unwrap_or(&"GET".into()).as_bytes() // TODO lol?
).unwrap_or(reqwest::Method::GET); // TODO throw an error rather than replacing it silently
@ -74,12 +74,12 @@ impl IntoRequest for v2_1_0::RequestClass {
_ => {},
}
out.build().unwrap() // TODO what about this?
out
}
}
impl IntoRequest for v1_0_0::Request {
fn make_request(&self) -> reqwest::Request {
fn make_request(&self) -> reqwest::RequestBuilder {
todo!()
}
}