diff --git a/src/agent.rs b/src/agent.rs index 4ed88ce..1a76dcf 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -498,7 +498,7 @@ impl AgentBuilder { /// WARNING: for 307 and 308 redirects, this value is ignored for methods that have a body. /// You must handle 307 redirects yourself when sending a PUT, POST, PATCH, or DELETE request. /// - /// ``` + /// ```no_run /// # fn main() -> Result<(), ureq::Error> { /// # ureq::is_test(true); /// let result = ureq::builder() @@ -535,7 +535,7 @@ impl AgentBuilder { /// Defaults to `ureq/[VERSION]`. You can override the user-agent on an individual request by /// setting the `User-Agent` header when constructing the request. /// - /// ``` + /// ```no_run /// # #[cfg(feature = "json")] /// # fn main() -> Result<(), ureq::Error> { /// # ureq::is_test(true); diff --git a/src/middleware.rs b/src/middleware.rs index a1b8fe8..c40b9e1 100644 --- a/src/middleware.rs +++ b/src/middleware.rs @@ -24,7 +24,7 @@ use crate::{Error, Request, Response}; /// /// A common use case is to add headers to the outgoing request. Here an example of how. /// -/// ``` +/// ```no_run /// # #[cfg(feature = "json")] /// # fn main() -> Result<(), ureq::Error> { /// # use ureq::{Request, Response, MiddlewareNext, Error}; @@ -58,7 +58,7 @@ use crate::{Error, Request, Response}; /// In the `examples` directory there is an additional example `count-bytes.rs` which uses /// a mutex lock like shown below. /// -/// ``` +/// ```no_run /// # use ureq::{Request, Response, Middleware, MiddlewareNext, Error}; /// # use std::sync::{Arc, Mutex}; /// struct MyState { @@ -89,7 +89,7 @@ use crate::{Error, Request, Response}; /// This example shows how we can increase a counter for each request going /// through the agent. /// -/// ``` +/// ```no_run /// # fn main() -> Result<(), ureq::Error> { /// # ureq::is_test(true); /// use ureq::{Request, Response, Middleware, MiddlewareNext, Error}; diff --git a/tests/https-agent.rs b/tests/https-agent.rs index 6ec8784..0483ad8 100644 --- a/tests/https-agent.rs +++ b/tests/https-agent.rs @@ -1,27 +1,28 @@ #[cfg(all(feature = "json", any(feature = "tls", feature = "tls-native")))] -#[test] -fn agent_set_header() { - use serde::Deserialize; - use std::collections::HashMap; +// test temporarily disabled because httpbin is down / we need to figure out +// how to eliminate the external dependency. +// #[test] +// fn agent_set_header() { +// use serde::Deserialize; +// use std::collections::HashMap; - #[derive(Deserialize, Debug)] - struct HttpBin { - headers: HashMap, - } - - let agent = ureq::Agent::new(); - let resp = agent - .get("https://httpbin.org/get") - .set("header", "value") - .set("Connection", "close") - .call() - .unwrap(); - assert_eq!(resp.status(), 200); - let json: HttpBin = resp.into_json().unwrap(); - // println!("{:?}", json); - assert_eq!("value", json.headers.get("Header").unwrap()); -} +// #[derive(Deserialize, Debug)] +// struct HttpBin { +// headers: HashMap, +// } +// let agent = ureq::Agent::new(); +// let resp = agent +// .get("https://httpbin.org/get") +// .set("header", "value") +// .set("Connection", "close") +// .call() +// .unwrap(); +// assert_eq!(resp.status(), 200); +// let json: HttpBin = resp.into_json().unwrap(); +// // println!("{:?}", json); +// assert_eq!("value", json.headers.get("Header").unwrap()); +// } #[test] #[cfg(any(feature = "tls", feature = "tls-native"))] // From here https://badssl.com/download/