#[cfg(test)] mod test;
use std::time::Duration;
use serde::{Serialize, de::DeserializeOwned};
use super::*;
use crate::{http::CLIENT, prelude::*};
pub async fn send<S, D>(uri: &str, s: &S, timeout: Duration) -> Result<Response<D>>
where
S: Serialize,
D: DeserializeOwned,
{
Ok(CLIENT
.post(uri)
.json(s)
.timeout(timeout)
.send()
.await
.map_err(error::Generic::Reqwest)?
.json::<Response<D>>()
.await
.map_err(error::Generic::Reqwest)?)
}