Logo

Programming-Idioms

History of Idiom 174 > diff from v17 to v18

Edit summary for version 18 by swedebugia:
New Rust implementation by user [swedebugia]

Version 17

2020-03-16, 17:18:46

Version 18

2020-04-16, 15:32:55

Idiom #174 Make HTTP POST request

Make a HTTP request with method POST to URL u

Idiom #174 Make HTTP POST request

Make a HTTP request with method POST to URL u

Imports
use reqwest;
Code
let client = reqwest::blocking::Client::new();
let resp = client.post("http://httpbin.org/post")
    .body("this is the body")
    .send()?;
Comments bubble
This relies on the (old) synchronous blocking client that is now an optional feature.
You have to specify it like this:
reqwest = { version = "*", features = ["blocking"] }
Doc URL
https://docs.rs/reqwest/0.10.4/reqwest/blocking/index.html
Origin
https://docs.rs/reqwest/0.10.4/reqwest/blocking/index.html