Skip to content

Commit 9bf39c9

Browse files
authored
Merge pull request #306 from joshtriplett/optional-cookies
Allow omitting cookie support, with a new "cookies" feature
2 parents d8cb1e8 + 015cf2f commit 9bf39c9

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ docs = ["unstable"]
2121
unstable = []
2222
hyperium_http = ["http"]
2323
async_std = ["fs"]
24-
cookie-secure = ["cookie/secure"]
24+
cookies = ["cookie"]
25+
cookie-secure = ["cookies", "cookie/secure"]
2526
fs = ["async-std"]
2627

2728
[dependencies]
@@ -34,7 +35,9 @@ async-channel = "1.5.1"
3435
http = { version = "0.2.0", optional = true }
3536

3637
anyhow = "1.0.26"
37-
cookie = { version = "0.14.0", features = ["percent-encode"] }
38+
39+
# features: cookies
40+
cookie = { version = "0.14.0", features = ["percent-encode"], optional = true }
3841
infer = "0.2.3"
3942
pin-project-lite = "0.2.0"
4043
url = { version = "2.1.1", features = ["serde"] }

src/headers/header_value.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ use std::fmt::{self, Debug, Display};
33
use std::str::FromStr;
44

55
use crate::headers::HeaderValues;
6+
#[cfg(feature = "cookies")]
7+
use crate::Cookie;
68
use crate::Error;
7-
use crate::{Cookie, Mime};
9+
use crate::Mime;
810

911
/// A header value.
1012
#[derive(Clone, Eq, PartialEq, Hash)]
@@ -54,6 +56,7 @@ impl From<Mime> for HeaderValue {
5456
}
5557
}
5658

59+
#[cfg(feature = "cookies")]
5760
impl From<Cookie<'_>> for HeaderValue {
5861
fn from(cookie: Cookie<'_>) -> Self {
5962
HeaderValue {

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
#![doc(html_logo_url = "https://yoshuawuyts.com/assets/http-rs/logo-rounded.png")]
103103

104104
/// HTTP cookies.
105+
#[cfg(feature = "cookies")]
105106
pub mod cookies {
106107
pub use cookie::*;
107108
}
@@ -163,6 +164,7 @@ pub use headers::Headers;
163164
#[doc(inline)]
164165
pub use crate::url::Url;
165166

167+
#[cfg(feature = "cookies")]
166168
#[doc(inline)]
167169
pub use crate::cookies::Cookie;
168170

0 commit comments

Comments
 (0)