This shows you the differences between two versions of the page.
userspace:webservice_corner:rust-rpc [2019/02/18 14:57] n.wenselowski created |
userspace:webservice_corner:rust-rpc [2021/08/23 08:37] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | |||
- | This script uses [[https:// | ||
- | Add the following to your `Cargo.toml`: | ||
- | |||
- | [dependencies] | ||
- | reqwest = " | ||
- | |||
- | |||
- | The //main.rs// looks like this: | ||
- | |||
- | extern crate reqwest; | ||
- | | ||
- | use std:: | ||
- | | ||
- | fn main() -> Result< | ||
- | let mut jrpc = HashMap:: | ||
- | jrpc.insert(" | ||
- | jrpc.insert(" | ||
- | jrpc.insert(" | ||
- | | ||
- | let client = reqwest:: | ||
- | let mut response = client.post(" | ||
- | .basic_auth(" | ||
- | .json(& | ||
- | .send()?; | ||
- | println!(" | ||
- | | ||
- | let content = response.text()?; | ||
- | println!(" | ||
- | | ||
- | Ok(()) | ||
- | } | ||
- | |||