Add comment

This commit is contained in:
nielsandriesse 2021-03-24 09:27:21 +11:00
parent be11886515
commit f23d974f1e
1 changed files with 5 additions and 1 deletions

View File

@ -25,7 +25,11 @@ pub async fn handle_rpc_call(rpc_call: RpcCall) -> Result<Response, Rejection> {
}
};
let pool = storage::pool_by_room_id(&room_id);
// Check that the endpoint is a valid URI
// Check that the endpoint is a valid URI and deconstruct it into a path
// and query parameters.
// Adding "http://placeholder.io" in front of the endpoint we get is a workaround
// for the fact that the URL crate doesn't accept relative URLs. There are
// other (cleaner) ways to fix this but they tend to be much more complex.
let raw_uri = format!("http://placeholder.io/{}", rpc_call.endpoint.trim_start_matches("/"));
let path: String = match raw_uri.parse::<http::Uri>() {
Ok(uri) => uri.path().trim_start_matches("/").to_string(),