Skip to content

Commit

Permalink
Bumped to reqwest 0.8 and image 0.16.
Browse files Browse the repository at this point in the history
Fixed resulting build breaks.
  • Loading branch information
budziq committed Oct 4, 2017
1 parent d8b20c3 commit 85778f8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env_logger = "0.4"
error-chain = "0.11"
flate2 = "0.2"
glob = "0.2"
image = "0.15"
image = "0.16"
lazy_static = "0.2"
log = "0.3"
log4rs = "0.7"
Expand All @@ -32,7 +32,7 @@ petgraph = "0.4"
rand = "0.3"
rayon = "0.8"
regex = "0.2"
reqwest = "0.7"
reqwest = "0.8"
ring = "0.12.0"
same-file = "0.1"
select = "0.4"
Expand Down
31 changes: 14 additions & 17 deletions src/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ fn run() -> Result<()> {
// The timeout for the request is set to 5 seconds.
let timeout = Duration::new(5, 0);
let client = ClientBuilder::new()?.timeout(timeout).build()?;
let response = client.head(&request_url)?.send()?;
let client = ClientBuilder::new().timeout(timeout).build()?;
let response = client.head(&request_url).send()?;
if response.status().is_success() {
println!("{} is a user!", user);
Expand Down Expand Up @@ -487,6 +487,7 @@ extern crate serde_derive;
use std::collections::HashMap;
use url::Url;
use reqwest::Client;
use reqwest::header::{UserAgent, Authorization, Bearer};
// Custom header type
Expand All @@ -506,15 +507,13 @@ pub struct HeadersEcho {
# }
fn run() -> Result<()> {
let client = reqwest::Client::new()?;
// Make request to webservice that will respond with JSON dict containing
// the headders set on HTTP GET request.
let url = Url::parse_with_params("http://httpbin.org/headers",
&[("lang", "rust"), ("browser", "servo")])?;
let mut response = client
.get(url)?
let mut response = Client::new()
.get(url)
.header(UserAgent::new("Rust-test"))
.header(Authorization(Bearer { token: "DEadBEEfc001cAFeEDEcafBAd".to_owned() }))
.header(XPoweredBy("Guybrush Threepwood".to_owned()))
Expand Down Expand Up @@ -560,6 +559,7 @@ extern crate serde_derive;
extern crate serde_json;
use std::env;
use reqwest::Client;
#
# error_chain! {
# foreign_links {
Expand Down Expand Up @@ -591,21 +591,19 @@ fn run() -> Result<()> {
// create the gist
let request_url = "https://api.github.com/gists";
let client = reqwest::Client::new()?;
let mut response = client
.post(request_url)?
let mut response = Client::new()
.post(request_url)
.basic_auth(gh_user.clone(), Some(gh_pass.clone()))
.json(&gist_body)?
.json(&gist_body)
.send()?;
let gist: Gist = response.json()?;
println!("Created {:?}", gist);
// delete the gist
let request_url = format!("{}/{}",request_url, gist.id);
let client = reqwest::Client::new()?;
let response = client
.delete(&request_url)?
let response = Client::new()
.delete(&request_url)
.basic_auth(gh_user, Some(gh_pass))
.send()?;
Expand Down Expand Up @@ -674,7 +672,7 @@ impl ReverseDependencies {
Ok(ReverseDependencies {
crate_id: crate_id.to_owned(),
dependencies: vec![].into_iter(),
client: reqwest::Client::new()?,
client: reqwest::Client::new(),
page: 0,
per_page: 100,
total: 0,
Expand All @@ -699,7 +697,7 @@ impl ReverseDependencies {
self.page,
self.per_page);
let response = self.client.get(&url)?.send()?.json::<ApiResponse>()?;
let response = self.client.get(&url).send()?.json::<ApiResponse>()?;
self.dependencies = response.dependencies.into_iter();
self.total = response.meta.total;
Ok(self.dependencies.next())
Expand Down Expand Up @@ -764,10 +762,9 @@ use reqwest::Client;
fn run() -> Result<()> {
let paste_api = "https://paste.rs";
let file = File::open("message")?;
let client = Client::new()?;
// blocks until paste.rs returns a response
let mut response = client.post(paste_api)?.body(file).send()?;
let mut response = Client::new().post(paste_api).body(file).send()?;
let mut response_body = String::new();
response.read_to_string(&mut response_body)?;
println!("Your paste is located at: {}", response_body);
Expand Down

0 comments on commit 85778f8

Please sign in to comment.