| 372 | |
| 373 | #[test] |
| 374 | fn accepts_lan_cookie_for_browser_ui() { |
| 375 | let config = Config::new( |
| 376 | 4310, |
| 377 | PathBuf::from("packages/client/dist"), |
| 378 | IpAddr::V4(Ipv4Addr::UNSPECIFIED), |
| 379 | Some("10.0.0.245".to_owned()), |
| 380 | ServerKind::Standalone, |
| 381 | "auto".to_owned(), |
| 382 | false, |
| 383 | Some("secret-token".to_owned()), |
| 384 | Some("123456".to_owned()), |
| 385 | ); |
| 386 | let mut headers = HeaderMap::new(); |
| 387 | headers.insert( |
| 388 | header::COOKIE, |
| 389 | HeaderValue::from_static("simdeck_token=secret-token"), |
| 390 | ); |
| 391 | headers.insert( |
| 392 | header::ORIGIN, |
| 393 | HeaderValue::from_static("http://10.0.0.245:4310"), |
| 394 | ); |
| 395 | |
| 396 | assert!(api_request_authorized( |
| 397 | &config, |
| 398 | &Method::POST, |
| 399 | &headers, |
| 400 | false, |
| 401 | None |
| 402 | )); |
| 403 | } |
| 404 | |
| 405 | #[test] |
| 406 | fn accepts_cookie_for_same_origin_tailscale_host() { |