We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 721ef45 + 1b14059 commit a797355Copy full SHA for a797355
download/tests/read-proxy-env.rs
@@ -0,0 +1,30 @@
1
+#![cfg(feature = "reqwest-backend")]
2
+
3
+use std::env::{remove_var, set_var};
4
5
+use env_proxy::for_url;
6
+use url::Url;
7
8
+fn scrub_env() {
9
+ remove_var("http_proxy");
10
+ remove_var("https_proxy");
11
+ remove_var("HTTPS_PROXY");
12
+ remove_var("ftp_proxy");
13
+ remove_var("FTP_PROXY");
14
+ remove_var("all_proxy");
15
+ remove_var("ALL_PROXY");
16
+ remove_var("no_proxy");
17
+ remove_var("NO_PROXY");
18
+}
19
20
+// Tests for correctly retrieving the proxy (host, port) tuple from $https_proxy
21
+#[test]
22
+fn read_basic_proxy_params() {
23
+ scrub_env();
24
+ set_var("https_proxy", "http://proxy.example.com:8080");
25
+ let u = Url::parse("https://www.example.org").ok().unwrap();
26
+ assert_eq!(
27
+ for_url(&u).host_port(),
28
+ Some(("proxy.example.com".to_string(), 8080))
29
+ );
30
0 commit comments