Extract the origin (scheme + host) from a gateway endpoint URL. For example, `https://8080-3vdegyusg.brevlab.com/some/path` → `https://8080-3vdegyusg.brevlab.com`. Returns `None` if the URL cannot be parsed.
(gateway_endpoint: &str)
| 214 | /// For example, `https://8080-3vdegyusg.brevlab.com/some/path` → `https://8080-3vdegyusg.brevlab.com`. |
| 215 | /// Returns `None` if the URL cannot be parsed. |
| 216 | fn extract_origin(gateway_endpoint: &str) -> Option<String> { |
| 217 | // Split on "://" to get scheme and the rest. |
| 218 | let (scheme, rest) = gateway_endpoint.split_once("://")?; |
| 219 | // The host (with optional port) is everything before the first '/'. |
| 220 | let host = rest.split('/').next().unwrap_or(rest); |
| 221 | Some(format!("{scheme}://{host}")) |
| 222 | } |
| 223 | |
| 224 | #[derive(Deserialize)] |
| 225 | struct CallbackPayload { |
no test coverage detected