committed by
Sean McArthur
parent
81e0f1ff2a
commit
cf8944a0f0
@@ -3,19 +3,16 @@
|
||||
//! This is useful for some ad-hoc experiments and situations when you don't
|
||||
//! really care about the structure of the JSON and just need to display it or
|
||||
//! process it at runtime.
|
||||
extern crate reqwest;
|
||||
#[macro_use] extern crate serde_json;
|
||||
use serde_json::json;
|
||||
|
||||
fn main() -> Result<(), reqwest::Error> {
|
||||
let echo_json: serde_json::Value = reqwest::Client::new()
|
||||
.post("https://jsonplaceholder.typicode.com/posts")
|
||||
.json(
|
||||
&json!({
|
||||
"title": "Reqwest.rs",
|
||||
"body": "https://docs.rs/reqwest",
|
||||
"userId": 1
|
||||
})
|
||||
)
|
||||
.json(&json!({
|
||||
"title": "Reqwest.rs",
|
||||
"body": "https://docs.rs/reqwest",
|
||||
"userId": 1
|
||||
}))
|
||||
.send()?
|
||||
.json()?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user