forked from seanmonstar/reqwest
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add native-tls and serde json support
- Loading branch information
1 parent
bfd95e3
commit 1259128
Showing
10 changed files
with
289 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# request | ||
# reqwest | ||
|
||
An ergonomic HTTP Client for Rust | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//#![feature(proc_macro)] | ||
|
||
extern crate reqwest; | ||
extern crate env_logger; | ||
//#[macro_use] extern crate serde_derive; | ||
|
||
/* | ||
#[derive(Serialize)] | ||
struct Thingy { | ||
a: i32, | ||
b: bool, | ||
c: String, | ||
} | ||
*/ | ||
|
||
fn main() { | ||
env_logger::init().unwrap(); | ||
|
||
println!("POST https://httpbin.org/post"); | ||
|
||
/* | ||
let thingy = Thingy { | ||
a: 5, | ||
b: true, | ||
c: String::from("reqwest") | ||
}; | ||
*/ | ||
|
||
let client = reqwest::Client::new(); | ||
let mut res = client.post("https://httpbin.org/post") | ||
.body("foo=bar") | ||
.send().unwrap(); | ||
|
||
println!("Status: {}", res.status()); | ||
println!("Headers:\n{}", res.headers()); | ||
|
||
::std::io::copy(&mut res, &mut ::std::io::stdout()).unwrap(); | ||
|
||
println!("\n\nDone."); | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.