Made proxy not panic when not passing query

proxy
Jef Roosens 2021-11-26 13:22:22 +01:00
parent b442e352b3
commit da2d31a838
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
1 changed files with 8 additions and 2 deletions

View File

@ -94,12 +94,18 @@ impl Handler for ProxyServer
// We first extract all URL segments starting from the mountpoint
let segments: PathBuf = req.segments(0..).unwrap();
let query_part = if let Some(query) = req.uri().query() {
format!("?{}", query)
}else{
String::from("")
};
let url = format!(
"{}{}/{}?{}",
"{}{}/{}{}",
self.root,
self.prefix.to_str().unwrap(),
segments.to_str().unwrap(),
req.uri().query().unwrap()
query_part
);
// And finally, the data