From 63c97d84d61070e46219027730026c3d72d52ad3 Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Mon, 20 Nov 2023 20:48:20 +0100 Subject: [PATCH] Don't export Header struct This struct does not need to be exported from the crate because it is not used in any public fn - it's internal. This is technically a breaking change, but in practice, not too bad since the struct is not used by the API. --- src/header.rs | 3 ++- src/http_interop.rs | 4 ++-- src/lib.rs | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/header.rs b/src/header.rs index ce3b87e8..42ccda37 100644 --- a/src/header.rs +++ b/src/header.rs @@ -65,7 +65,7 @@ impl fmt::Display for HeaderLine { #[derive(Clone, PartialEq, Eq)] /// Wrapper type for a header field. /// -pub struct Header { +pub(crate) struct Header { // Line contains the unmodified bytes of single header field. // It does not contain the final CRLF. line: HeaderLine, @@ -115,6 +115,7 @@ impl Header { /// /// ureq can't know what encoding the header is in, but this function provides /// an escape hatch for users that need to handle such headers. + #[cfg(feature = "http-interop")] pub fn value_raw(&self) -> &[u8] { let mut bytes = &self.line.as_bytes()[self.index + 1..]; diff --git a/src/http_interop.rs b/src/http_interop.rs index c3cd8eac..2da717a9 100644 --- a/src/http_interop.rs +++ b/src/http_interop.rs @@ -8,8 +8,8 @@ use crate::{header::HeaderLine, response::ResponseStatusIndex, Request, Response /// Converts an [`http::Response`] into a [`Response`]. /// /// As an [`http::Response`] does not contain a URL, `"https://example.com/"` is used as a -/// placeholder. Additionally, if the response has a header which cannot be converted into a valid -/// [`Header`](crate::Header), it will be skipped rather than having the conversion fail. The remote +/// placeholder. Additionally, if the response has a header which cannot be converted into +/// the ureq equivalent, it will be skipped rather than having the conversion fail. The remote /// address property will also always be `127.0.0.1:80` for similar reasons to the URL. /// /// ``` diff --git a/src/lib.rs b/src/lib.rs index 8639c653..56402f7a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -424,7 +424,6 @@ pub use crate::agent::Agent; pub use crate::agent::AgentBuilder; pub use crate::agent::RedirectAuthHeaders; pub use crate::error::{Error, ErrorKind, OrAnyStatus, Transport}; -pub use crate::header::Header; pub use crate::middleware::{Middleware, MiddlewareNext}; pub use crate::proxy::Proxy; pub use crate::request::{Request, RequestUrl};