// pub(crate) fn create_post(path: &str) -> RequestBuilder {
//     REQWEST_CLIENT.post(&format!("http://{}/{}", HOST, path))
// }

pub(crate) fn webapi_post<T: Serialize + ?Sized>(path: &str, json: &T) -> Result<Value, String> {
    let post = REQWEST_CLIENT.post(&format!("http://{}/{}", &*HOST, path));
    let response = post
        .json(json)
        .send()
        .map_err(|e| format!("{:?}", e))?
        .text()
        .map_err(|e| format!("{:?}", e))?;
    let value: Value = serde_json::from_str(&response).map_err(|e| format!("{:?}", e))?;