Fix main lib.rs and README.md example (#284)

Small fixes to just ensure lib.rs and README.md are run via cargo readme.
This commit is contained in:
Martin Algesten
2021-01-03 19:38:10 +01:00
committed by GitHub
parent 7ffaa8cf9a
commit 8f9f3e5827
3 changed files with 28 additions and 16 deletions

View File

@@ -25,11 +25,11 @@
//! ```rust
//! fn main() -> Result<(), ureq::Error> {
//! # ureq::is_test(true);
//! let body: String = ureq::get("http://example.com")
//! .set("Example-Header", "header value")
//! .call()?
//! .into_string()?;
//! Ok(())
//! let body: String = ureq::get("http://example.com")
//! .set("Example-Header", "header value")
//! .call()?
//! .into_string()?;
//! Ok(())
//! }
//! ```
//!
@@ -86,7 +86,7 @@
//!
//! ureq returns errors via `Result<T, ureq::Error>`. That includes I/O errors,
//! protocol errors, and status code errors (when the server responded 4xx or
//! 5xx).
//! 5xx)
//!
//! ```rust
//! use ureq::Error;

View File

@@ -11,9 +11,9 @@ use url::Url;
use crate::error::{Error, ErrorKind::BadStatus};
use crate::header::Header;
use crate::pool::PoolReturnRead;
use crate::stream;
use crate::stream::{DeadlineStream, Stream};
use crate::unit::Unit;
use crate::stream;
#[cfg(feature = "json")]
use serde::de::DeserializeOwned;