a few fixes

This commit is contained in:
Sean McArthur
2016-11-08 18:56:49 -08:00
parent 1741efc089
commit 4f9e39829c
3 changed files with 21 additions and 10 deletions

View File

@@ -1,5 +1,21 @@
# reqwest # reqwest
An ergonomic HTTP Client for Rust [![Travis CI Status](https://travis-ci.org/seanmonstar/reqwest.svg?branch=master)
[![crates.io](https://img.shields.io/crates/v/reqwest.svg)](https://crates.io/crates/reqwest)
An ergonomic HTTP Client for Rust.
Built on top of [hyper](http://hyper.rs), with a batteries-included mindset.
- [Documentation](https://docs.rs/reqwest)
## License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

View File

@@ -69,12 +69,6 @@ impl Client {
} }
} }
#[cfg(not(feature = "tls"))]
fn new_hyper_client() -> ::Result<::hyper::Client> {
Ok(::hyper::Client::new())
}
#[cfg(feature = "tls")]
fn new_hyper_client() -> ::Result<::hyper::Client> { fn new_hyper_client() -> ::Result<::hyper::Client> {
use tls::TlsClient; use tls::TlsClient;
Ok(::hyper::Client::with_connector( Ok(::hyper::Client::with_connector(

View File

@@ -91,12 +91,13 @@
extern crate hyper; extern crate hyper;
#[macro_use] extern crate log; #[macro_use] extern crate log;
#[cfg(feature = "tls")] extern crate native_tls; extern crate native_tls;
extern crate serde; extern crate serde;
extern crate serde_json; extern crate serde_json;
extern crate serde_urlencoded; extern crate serde_urlencoded;
extern crate url; extern crate url;
pub use hyper::client::IntoUrl;
pub use hyper::header; pub use hyper::header;
pub use hyper::method::Method; pub use hyper::method::Method;
pub use hyper::status::StatusCode; pub use hyper::status::StatusCode;
@@ -111,11 +112,11 @@ pub use self::body::Body;
mod body; mod body;
mod client; mod client;
mod error; mod error;
mod tls;
#[cfg(feature = "tls")] mod tls;
/// Shortcut method to quickly make a `GET` request. /// Shortcut method to quickly make a `GET` request.
pub fn get(url: &str) -> ::Result<Response> { pub fn get<T: IntoUrl>(url: T) -> ::Result<Response> {
let client = try!(Client::new()); let client = try!(Client::new());
client.get(url).send() client.get(url).send()
} }