This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs-object-store.git


The following commit(s) were added to refs/heads/main by this push:
     new 8a7bc6e  feat: re-export HTTP types used in public API (#441)
8a7bc6e is described below

commit 8a7bc6e9ef94f889841620db597805728dfb37ad
Author: sktrpathi <[email protected]>
AuthorDate: Tue Jul 29 23:42:58 2025 +0530

    feat: re-export HTTP types used in public API (#441)
    
    Re-export `HeaderMap`, `HeaderValue`, and `Extensions` from http crate to
    avoid forcing users to add http dependency when using object_store public 
API.
    
    Fixes #263
---
 src/buffered.rs |  8 ++++----
 src/lib.rs      | 27 ++++++++++++++++++++++++---
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/src/buffered.rs b/src/buffered.rs
index f189c53..00bea05 100644
--- a/src/buffered.rs
+++ b/src/buffered.rs
@@ -19,8 +19,8 @@
 
 use crate::path::Path;
 use crate::{
-    Attributes, ObjectMeta, ObjectStore, PutMultipartOptions, PutOptions, 
PutPayloadMut, TagSet,
-    WriteMultipart,
+    Attributes, Extensions, ObjectMeta, ObjectStore, PutMultipartOptions, 
PutOptions,
+    PutPayloadMut, TagSet, WriteMultipart,
 };
 use bytes::Bytes;
 use futures::future::{BoxFuture, FutureExt};
@@ -222,7 +222,7 @@ pub struct BufWriter {
     max_concurrency: usize,
     attributes: Option<Attributes>,
     tags: Option<TagSet>,
-    extensions: Option<::http::Extensions>,
+    extensions: Option<Extensions>,
     state: BufWriterState,
     store: Arc<dyn ObjectStore>,
 }
@@ -297,7 +297,7 @@ impl BufWriter {
     /// that need to pass context-specific information (like tracing spans) 
via trait methods.
     ///
     /// These extensions are ignored entirely by backends offered through this 
crate.
-    pub fn with_extensions(self, extensions: ::http::Extensions) -> Self {
+    pub fn with_extensions(self, extensions: Extensions) -> Self {
         Self {
             extensions: Some(extensions),
             ..self
diff --git a/src/lib.rs b/src/lib.rs
index 7d56dff..089b157 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -567,6 +567,9 @@ pub use payload::*;
 pub use upload::*;
 pub use util::{coalesce_ranges, collect_bytes, GetRange, 
OBJECT_STORE_COALESCE_DEFAULT};
 
+// Re-export HTTP types used in public API
+pub use ::http::{Extensions, HeaderMap, HeaderValue};
+
 use crate::path::Path;
 #[cfg(all(feature = "fs", not(target_arch = "wasm32")))]
 use crate::util::maybe_spawn_blocking;
@@ -987,7 +990,7 @@ pub struct GetOptions {
     /// that need to pass context-specific information (like tracing spans) 
via trait methods.
     ///
     /// These extensions are ignored entirely by backends offered through this 
crate.
-    pub extensions: ::http::Extensions,
+    pub extensions: Extensions,
 }
 
 impl GetOptions {
@@ -1184,7 +1187,7 @@ pub struct PutOptions {
     /// These extensions are ignored entirely by backends offered through this 
crate.
     ///
     /// They are also eclused from [`PartialEq`] and [`Eq`].
-    pub extensions: ::http::Extensions,
+    pub extensions: Extensions,
 }
 
 impl PartialEq<Self> for PutOptions {
@@ -1256,7 +1259,7 @@ pub struct PutMultipartOptions {
     /// These extensions are ignored entirely by backends offered through this 
crate.
     ///
     /// They are also eclused from [`PartialEq`] and [`Eq`].
-    pub extensions: ::http::Extensions,
+    pub extensions: Extensions,
 }
 
 impl PartialEq<Self> for PutMultipartOptions {
@@ -1649,4 +1652,22 @@ mod tests {
         options.if_match = Some("*".to_string()); // Passes if file exists
         options.check_preconditions(&meta).unwrap();
     }
+
+    #[test]
+    #[cfg(feature = "http")]
+    fn test_reexported_types() {
+        // Test HeaderMap
+        let mut headers = HeaderMap::new();
+        headers.insert("content-type", HeaderValue::from_static("text/plain"));
+        assert_eq!(headers.len(), 1);
+
+        // Test HeaderValue
+        let value = HeaderValue::from_static("test-value");
+        assert_eq!(value.as_bytes(), b"test-value");
+
+        // Test Extensions
+        let mut extensions = Extensions::new();
+        extensions.insert("test-key");
+        assert!(extensions.get::<&str>().is_some());
+    }
 }

Reply via email to