Make cookies an optional feature (default off)
This commit is contained in:
@@ -392,6 +392,11 @@ impl ClientBuilder {
|
||||
/// .build()
|
||||
/// .unwrap();
|
||||
/// ```
|
||||
///
|
||||
/// # Optional
|
||||
///
|
||||
/// This requires the optional `cookies` feature to be enabled.
|
||||
#[cfg(feature = "cookies")]
|
||||
pub fn cookie_store(self, enable: bool) -> ClientBuilder {
|
||||
self.with_inner(|inner| inner.cookie_store(enable))
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ use serde::de::DeserializeOwned;
|
||||
|
||||
use super::client::KeepCoreThreadAlive;
|
||||
use super::wait;
|
||||
#[cfg(feature = "cookies")]
|
||||
use crate::cookie;
|
||||
use crate::{async_impl, StatusCode, Url, Version};
|
||||
|
||||
@@ -121,6 +122,11 @@ impl Response {
|
||||
/// Retrieve the cookies contained in the response.
|
||||
///
|
||||
/// Note that invalid 'Set-Cookie' headers will be ignored.
|
||||
///
|
||||
/// # Optional
|
||||
///
|
||||
/// This requires the optional `cookies` feature to be enabled.
|
||||
#[cfg(feature = "cookies")]
|
||||
pub fn cookies<'a>(&'a self) -> impl Iterator<Item = cookie::Cookie<'a>> + 'a {
|
||||
cookie::extract_response_cookies(self.headers()).filter_map(Result::ok)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user