use crate::response::response::Response;
pub struct Application{
pub request:http::Request<Vec<u8>>,
pub reponse:Response,
}
impl Application {
pub fn new() -> Self {
let defaul_req = http::Request::builder()
.uri("https://www.funxdata.com");
let body = "0".as_bytes().to_vec().into();
let req = defaul_req.body(body).unwrap();
Application {
request:req,
reponse:Response::new(),
}
}
pub fn mock_from_json(json: &str) -> Self {
let body = json.as_bytes().to_vec();
let request = http::Request::builder()
.method("POST")
.uri("http://test.mock.com")
.header("content-type", "application/json")
.body(body)
.unwrap();
Self {
request,
reponse: Response::new(),
}
}
}