Created
September 5, 2019 21:07
-
-
Save bowrocker/48486ea62e9217df4231dfa48e45caa4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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