Make the async Client default (#626)
The previously default Client is moved to `reqwest::blocking`, while the async client becomes the main API. Closes #622
This commit is contained in:
@@ -33,7 +33,7 @@ impl Body {
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # use reqwest::r#async::Body;
|
||||
/// # use reqwest::Body;
|
||||
/// # use futures;
|
||||
/// # fn main() {
|
||||
/// let chunks: Vec<Result<_, ::std::io::Error>> = vec![
|
||||
|
||||
@@ -61,7 +61,7 @@ impl Form {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let form = reqwest::r#async::multipart::Form::new()
|
||||
/// let form = reqwest::multipart::Form::new()
|
||||
/// .text("username", "seanmonstar")
|
||||
/// .text("password", "secret");
|
||||
/// ```
|
||||
|
||||
@@ -194,8 +194,8 @@ impl RequestBuilder {
|
||||
/// # use reqwest::Error;
|
||||
///
|
||||
/// # async fn run() -> Result<(), Error> {
|
||||
/// let client = reqwest::r#async::Client::new();
|
||||
/// let form = reqwest::r#async::multipart::Form::new()
|
||||
/// let client = reqwest::Client::new();
|
||||
/// let form = reqwest::multipart::Form::new()
|
||||
/// .text("key3", "value3")
|
||||
/// .text("key4", "value4");
|
||||
///
|
||||
@@ -329,7 +329,7 @@ impl RequestBuilder {
|
||||
/// # use reqwest::Error;
|
||||
/// #
|
||||
/// # async fn run() -> Result<(), Error> {
|
||||
/// let response = reqwest::r#async::Client::new()
|
||||
/// let response = reqwest::Client::new()
|
||||
/// .get("https://hyper.rs")
|
||||
/// .send()
|
||||
/// .await?;
|
||||
|
||||
@@ -186,7 +186,7 @@ impl Response {
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # use reqwest::r#async::Response;
|
||||
/// # use reqwest::Response;
|
||||
/// fn on_response(res: Response) {
|
||||
/// match res.error_for_status() {
|
||||
/// Ok(_res) => (),
|
||||
@@ -216,7 +216,7 @@ impl Response {
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # use reqwest::r#async::Response;
|
||||
/// # use reqwest::Response;
|
||||
/// fn on_response(res: &Response) {
|
||||
/// match res.error_for_status_ref() {
|
||||
/// Ok(_res) => (),
|
||||
@@ -347,25 +347,6 @@ struct ResponseUrl(Url);
|
||||
pub trait ResponseBuilderExt {
|
||||
/// A builder method for the `http::response::Builder` type that allows the user to add a `Url`
|
||||
/// to the `http::Response`
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate url;
|
||||
/// # extern crate http;
|
||||
/// # extern crate reqwest;
|
||||
/// # use std::error::Error;
|
||||
/// use url::Url;
|
||||
/// use http::response::Builder;
|
||||
/// use reqwest::r#async::ResponseBuilderExt;
|
||||
/// # fn main() -> Result<(), Box<dyn Error>> {
|
||||
/// let response = Builder::new()
|
||||
/// .status(200)
|
||||
/// .url(Url::parse("http://example.com")?)
|
||||
/// .body(())?;
|
||||
///
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
fn url(&mut self, url: Url) -> &mut Self;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user