add proxy authorization
This commit is contained in:
		| @@ -1,5 +1,7 @@ | ||||
| extern crate reqwest; | ||||
|  | ||||
| use reqwest::header::Bearer; | ||||
|  | ||||
| #[macro_use] | ||||
| mod support; | ||||
|  | ||||
| @@ -12,6 +14,7 @@ fn test_http_proxy() { | ||||
|             User-Agent: $USERAGENT\r\n\ | ||||
|             Accept: */*\r\n\ | ||||
|             Accept-Encoding: gzip\r\n\ | ||||
|             Authorization: Bearer MY_SECRET_TOKEN\r\n\ | ||||
|             \r\n\ | ||||
|             ", | ||||
|         response: b"\ | ||||
| @@ -23,7 +26,8 @@ fn test_http_proxy() { | ||||
|     }; | ||||
|  | ||||
|     let proxy_uri = format!("http://{}", server.addr()); | ||||
|     let proxy = reqwest::Proxy::http(&proxy_uri).unwrap(); | ||||
|     let mut proxy = reqwest::Proxy::http(&proxy_uri).unwrap(); | ||||
|     proxy.set_authorization(Bearer { token: "MY_SECRET_TOKEN".to_string() }); | ||||
|  | ||||
|     let url = "http://hyper.rs/prox"; | ||||
|     let res = reqwest::Client::builder() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user