You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`hmac_openssl`: enables HMAC signing using `openssl`. If both `hmac_openssl` and `hmac_rust` are enabled, `hmac_openssl` is used.
51
54
-`hmac_rust`: enables HMAC signing using rust-native libraries `sha2` and `hmac`. If both `hmac_openssl` and `hmac_rust` are enabled, `hmac_openssl` is used.
52
-
-`reqwest` (default): enables and sets `reqwest` as the default `HttpClient`. Enables `reqwest`'s `native-tls` feature.
55
+
-`reqwest` (default): enables and sets `reqwest` as the default `HttpClient`.
53
56
-`reqwest_deflate` (default): enables deflate compression for `reqwest`.
54
57
-`reqwest_gzip` (default): enables gzip compression for `reqwest`.
55
58
-`reqwest_native-tls` (default): enables `reqwest`'s `native-tls` feature, which uses schannel on Windows and openssl elsewhere.
56
59
-`tokio`: enables and sets `tokio` as the default async runtime.
57
60
-`wasm_bindgen`: enables the async runtime for WASM.
58
61
-`xml`: enables XML support.
59
62
63
+
### Enabling dependencies' features
64
+
65
+
We define features to avoid dependencies which may be unnecessary for some applications or even some client libraries e.g.,
66
+
some Azure services do not support the `accept-encoding` request header nor send `content-encoding` back so there's no need to add `reqwest_gzip` by default
67
+
for all client libraries. We also want to support developers that want to use additional features of some dependencies like `reqwest`
68
+
or even replace some dependencies completely like `reqwest` or `tokio` to use different HTTP clients or async runtimes.
69
+
70
+
We do not define features to provide parity with all dependencies' features since the [resolver](https://doc.rust-lang.org/cargo/reference/resolver.html)
71
+
will unify features e.g., you can add `reqwest`'s `system-proxy` feature without making any changes to Azure SDK dependencies:
72
+
73
+
```toml
74
+
[dependencies]
75
+
azure_identity = "1"
76
+
azure_security_keyvault_secrets = "1"
77
+
reqwest = { version = "0.12.23", features = ["system-proxy"] }
78
+
```
79
+
80
+
Similarly, you can choose to support `reqwest::Client` but use `rustls-tls` with a different TLS provider by disabling our default features
81
+
and adding only what you need, such as our `reqwest` feature just to enable the `HttpClient` trait implementation on `reqwest::Client` and
82
+
add a dependency on `reqwest` with the feature you want:
83
+
84
+
```toml
85
+
[dependencies]
86
+
azure_core = { version = "1", default-features = false, features = ["reqwest"] }
87
+
azure_identity = { version = "1", default-features = false }
88
+
azure_security_keyvault_secrets = { version = "1", default-features = false }
89
+
reqwest = { version = "0.12.23", features = ["rustls-tls-webpki-roots"] }
90
+
```
91
+
92
+
You could even completely replace `reqwest` and provide your own `HttpClient` implementation. See [an example](#other-http-client) below.
93
+
60
94
## Examples
61
95
62
96
**NOTE:** Samples in this file apply only to packages that follow [Azure SDK Design Guidelines][guidelines]. Names of such packages typically start with `azure_`.
When a service call fails, the returned `Result` will contain an `Error`. The `Error` type provides a status property with an HTTP status code and an error_code property with a service-specific error code.
149
183
@@ -424,7 +458,7 @@ let client = SecretClient::new(
424
458
.unwrap();
425
459
```
426
460
427
-
#### Other
461
+
#### Other HTTP client
428
462
429
463
If you do not want to take a dependency on [`reqwest`] at all - perhaps because you [want to use a different async runtime](#replacing-the-async-runtime) other than [`tokio`] -
430
464
you can implement the `HttpClient` (recommended) or the `Policy` trait yourself.
0 commit comments