(port: u16, text: &str, proxy_prefix: &str)
| 1053 | } |
| 1054 | |
| 1055 | fn rewrite_loopback_metro_origins(port: u16, text: &str, proxy_prefix: &str) -> String { |
| 1056 | [ |
| 1057 | format!("http://127.0.0.1:{port}"), |
| 1058 | format!("http://localhost:{port}"), |
| 1059 | format!("http://[::1]:{port}"), |
| 1060 | ] |
| 1061 | .into_iter() |
| 1062 | .fold(text.to_owned(), |rewritten, origin| { |
| 1063 | rewritten.replace(&origin, proxy_prefix) |
| 1064 | }) |
| 1065 | } |
| 1066 | |
| 1067 | fn rewrite_absolute_metro_paths(text: &str, proxy_prefix: &str) -> String { |
| 1068 | let mut rewritten = String::with_capacity(text.len()); |
no test coverage detected