11use reqwest:: Proxy ;
2+ use url:: Url ;
23
34use crate :: sdk:: authentication:: Authenticate ;
45
@@ -20,6 +21,8 @@ pub struct OptionsBuilder {
2021 headers : Vec < ( String , String ) > ,
2122 authentication : Option < Box < dyn Authenticate > > ,
2223
24+ url : Option < Url > ,
25+
2326 proxy : Option < Proxy > ,
2427}
2528
@@ -35,6 +38,8 @@ impl OptionsBuilder {
3538 headers : vec ! [ ] ,
3639 authentication,
3740
41+ url : None ,
42+
3843 proxy : None ,
3944 }
4045 }
@@ -49,6 +54,8 @@ impl OptionsBuilder {
4954 headers : self . headers ,
5055 authentication : self . authentication ,
5156
57+ url : self . url ,
58+
5259 proxy : self . proxy ,
5360 }
5461 }
@@ -77,6 +84,12 @@ impl OptionsBuilder {
7784 self
7885 }
7986
87+ /// Sets the base url that the request should use.
88+ pub fn with_url ( mut self , url : Url ) -> Self {
89+ self . url = Some ( url) ;
90+ self
91+ }
92+
8093 /// Adds a custom proxy for the request to point to.
8194 pub fn with_proxy ( mut self , proxy : Proxy ) -> Self {
8295 self . proxy = Some ( proxy) ;
@@ -104,6 +117,9 @@ pub struct Options {
104117 // Authentication
105118 pub ( crate ) authentication : Option < Box < dyn Authenticate > > ,
106119
120+ // Url
121+ pub ( crate ) url : Option < Url > ,
122+
107123 // Proxy
108124 pub ( crate ) proxy : Option < Proxy > ,
109125}
@@ -116,6 +132,7 @@ impl Clone for Options {
116132 logging_enabled : self . logging_enabled ,
117133 headers : self . headers . clone ( ) ,
118134 authentication : self . authentication . as_ref ( ) . map ( |x| x. clone_box ( ) ) ,
135+ url : self . url . clone ( ) ,
119136 proxy : self . proxy . clone ( ) ,
120137 }
121138 }
0 commit comments