mod httpclient;
pub use httpclient::*;
impl Default for HttpRequest {
fn default() -> HttpRequest {
HttpRequest {
method: "GET".to_string(),
url: String::default(),
headers: HeaderMap::default(),
body: Vec::default(),
}
}
}
impl HttpRequest {
pub fn get(url: &str) -> HttpRequest {
HttpRequest {
url: url.to_string(),
..Default::default()
}
}
pub fn post(url: &str, body: Vec<u8>) -> HttpRequest {
HttpRequest {
method: "POST".to_string(),
url: url.to_string(),
body,
..Default::default()
}
}
pub fn put(url: &str, body: Vec<u8>) -> HttpRequest {
HttpRequest {
method: "PUT".to_string(),
url: url.to_string(),
body,
..Default::default()
}
}
}
impl Default for HttpResponse {
fn default() -> HttpResponse {
HttpResponse {
status_code: 200,
header: HeaderMap::default(),
body: Vec::default(),
}
}
}