Made proxy not panic when not passing query
parent
b442e352b3
commit
da2d31a838
10
src/proxy.rs
10
src/proxy.rs
|
@ -94,12 +94,18 @@ impl Handler for ProxyServer
|
||||||
// We first extract all URL segments starting from the mountpoint
|
// We first extract all URL segments starting from the mountpoint
|
||||||
let segments: PathBuf = req.segments(0..).unwrap();
|
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!(
|
let url = format!(
|
||||||
"{}{}/{}?{}",
|
"{}{}/{}{}",
|
||||||
self.root,
|
self.root,
|
||||||
self.prefix.to_str().unwrap(),
|
self.prefix.to_str().unwrap(),
|
||||||
segments.to_str().unwrap(),
|
segments.to_str().unwrap(),
|
||||||
req.uri().query().unwrap()
|
query_part
|
||||||
);
|
);
|
||||||
|
|
||||||
// And finally, the data
|
// And finally, the data
|
||||||
|
|
Reference in New Issue