Skip to content

Instantly share code, notes, and snippets.

@bowrocker
Created September 5, 2019 21:07
Show Gist options
  • Save bowrocker/48486ea62e9217df4231dfa48e45caa4 to your computer and use it in GitHub Desktop.
Save bowrocker/48486ea62e9217df4231dfa48e45caa4 to your computer and use it in GitHub Desktop.
/// Generic post
fn post<S>(
&self,
url: S,
body: &Value
) -> Result<Response, Box<dyn std::error::Error>>
where
S: IntoUrl,
{
match self.client
.post(url)
.headers_011(self.default_headers())
.json(&body)
.send() {
Ok(response) => Ok(response),
Err(e) => Err(Box::new(e))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment