add native-tls and serde json support

This commit is contained in:
Sean McArthur
2016-10-22 21:48:29 -07:00
parent bfd95e3194
commit 1259128d92
10 changed files with 289 additions and 20 deletions

View File

@@ -1,9 +1,37 @@
#![allow(warnings)]
#![deny(warnings)]
#![deny(missing_docs)]
//! # reqwest
//!
//! The `reqwest` crate provides a convenient, higher-level HTTP Client.
//!
//! It handles many of the things that most people just expect an HTTP client
//! to do for them.
//!
//! - Uses system-native TLS
//! - Plain bodies, JSON, urlencoded, multipart
//! - Customizable redirect policy
//! - Cookies
//!
//! The `reqwest::Client` is synchronous, making it a great fit for
//! applications that only require a few HTTP requests, and wish to handle
//! them synchronously. When [hyper][] releases with asynchronous support,
//! `reqwest` will be updated to use it internally, but still provide a
//! synchronous Client, for convenience. A `reqwest::async::Client` will also
//! be added.
//!
//! ## Making a GET request
//!
//! ```no_run
//! let resp = reqwest::get("https://www.rust-lang.org").unwrap();
//! assert!(resp.status().is_success());
//! ```
extern crate hyper;
#[macro_use] extern crate log;
#[cfg(feature = "tls")] extern crate native_tls;
extern crate serde;
extern crate serde_json;
pub use hyper::header;
pub use hyper::method::Method;
@@ -18,6 +46,9 @@ mod body;
mod client;
mod error;
#[cfg(feature = "tls")] mod tls;
/// Shortcut method to quickly make a `GET` request.
pub fn get(url: &str) -> ::Result<Response> {
let client = Client::new();
client.get(url).send()