(path: String, access_token: Option<&str>)
| 895 | } |
| 896 | |
| 897 | fn websocket_path_with_access_token(path: String, access_token: Option<&str>) -> String { |
| 898 | let Some(access_token) = access_token |
| 899 | .map(str::trim) |
| 900 | .filter(|access_token| !access_token.is_empty()) |
| 901 | else { |
| 902 | return path; |
| 903 | }; |
| 904 | let separator = if path.contains('?') { '&' } else { '?' }; |
| 905 | format!( |
| 906 | "{path}{separator}simdeckToken={}", |
| 907 | percent_encode_query_component(access_token) |
| 908 | ) |
| 909 | } |
| 910 | |
| 911 | /// Reverse-proxies a Metro HTTP path over the SimDeck origin. The upstream |
| 912 | /// request omits the browser `Origin` so Metro's dev-middleware does not reject |
no test coverage detected