Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ nix = { version = "0.31.1", features = ["fs"] }
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
web-time = { version = "1.1.0" }
wasm-bindgen-futures = "0.4.18"
worker = { version = "0.8", optional = true }
futures-channel = {version = "0.3", features = ["sink"]}

[features]
default = ["fs"]
cloud = ["serde", "serde_json", "quick-xml", "hyper", "reqwest", "reqwest/stream", "chrono/serde", "base64", "rand", "ring", "http-body-util", "form_urlencoded", "serde_urlencoded", "tokio"]
azure = ["cloud", "httparse"]
cloudflare = ["cloud", "aws"]
cloudflare-workers = ["worker"]
fs = ["walkdir", "tokio", "nix", "windows-sys"]
gcp = ["cloud", "rustls-pki-types"]
aws = ["cloud", "crc-fast", "md-5"]
Expand Down
4 changes: 2 additions & 2 deletions src/client/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl HttpRequestBuilder {
self
}

#[cfg(feature = "gcp")]
#[cfg(any(feature = "gcp", feature = "cloudflare"))]
pub(crate) fn bearer_auth(mut self, token: &str) -> Self {
let value = HeaderValue::try_from(format!("Bearer {token}"));
match (value, &mut self.request) {
Expand All @@ -177,7 +177,7 @@ impl HttpRequestBuilder {
self
}

#[cfg(any(test, feature = "aws", feature = "gcp", feature = "azure"))]
#[cfg(any(test, feature = "aws", feature = "gcp", feature = "azure", feature = "cloudflare"))]
pub(crate) fn query<T: serde::Serialize + ?Sized>(mut self, query: &T) -> Self {
let mut error = None;
if let Ok(ref mut req) = self.request {
Expand Down
4 changes: 2 additions & 2 deletions src/client/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub(crate) enum Error {
}

/// Extracts a PutResult from the provided [`HeaderMap`]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure", feature = "cloudflare"))]
pub(crate) fn get_put_result(
headers: &HeaderMap,
version: &str,
Expand All @@ -82,7 +82,7 @@ pub(crate) fn get_put_result(
}

/// Extracts a optional version from the provided [`HeaderMap`]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure", feature = "cloudflare"))]
pub(crate) fn get_version(headers: &HeaderMap, version: &str) -> Result<Option<String>, Error> {
Ok(match headers.get(version) {
Some(x) => Some(
Expand Down
2 changes: 1 addition & 1 deletion src/client/http/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl HttpResponseBody {
String::from_utf8(b.into()).map_err(|e| HttpError::new(HttpErrorKind::Decode, e))
}

#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure", feature = "cloudflare"))]
pub(crate) async fn json<B: serde::de::DeserializeOwned>(self) -> Result<B, HttpError> {
let b = self.bytes().await?;
serde_json::from_slice(&b).map_err(|e| HttpError::new(HttpErrorKind::Decode, e))
Expand Down
10 changes: 5 additions & 5 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ pub(crate) mod mock_server;

pub(crate) mod retry;

#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure", feature = "cloudflare"))]
pub(crate) mod pagination;

pub(crate) mod get;

#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure", feature = "cloudflare"))]
pub(crate) mod list;

#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure", feature = "cloudflare"))]
pub(crate) mod token;

pub(crate) mod header;

#[cfg(any(feature = "aws", feature = "gcp"))]
#[cfg(any(feature = "aws", feature = "gcp", feature = "cloudflare"))]
pub(crate) mod s3;

pub(crate) mod builder;
mod http;

#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure", feature = "cloudflare"))]
pub(crate) mod parts;
pub use http::*;

Expand Down
Loading