-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update example to be something that works when run
Also add the README example to examples/ to ensure it keeps working fixes: #6
- Loading branch information
Showing
3 changed files
with
19 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use http_io::error::Result; | ||
use std::fs::File; | ||
use std::io; | ||
|
||
fn main() -> Result<()> { | ||
// Stream contents of url to stdout | ||
let mut body = http_io::client::get("https://postman-echo.com/get")?; | ||
io::copy(&mut body, &mut std::io::stdout())?; | ||
|
||
// Stream contents of file to remote server | ||
let file = File::open("src/client.rs")?; | ||
http_io::client::put("https://postman-echo.com/put", file)?; | ||
Ok(()) | ||
} |
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