Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveklabnik/54cf7a4a522cd1a7c6e0130760903b75 to your computer and use it in GitHub Desktop.
Save steveklabnik/54cf7a4a522cd1a7c6e0130760903b75 to your computer and use it in GitHub Desktop.
let s;
let mut req = self.client
.post(&addr)
.header(Connection::close())
.header(ContentType::json())
.header(Authorization(Bearer { token: String::from(self.token) }));
if let &mut Some(ref c) = context {
s = match serde_json::to_string(c) {
Ok(r) => r,
Err(_) => return Converse::Result::Error("serde_json::to_string(context) failed."),
};
req = req.body(&s);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment