in src/utils.rs [88:109]
fn get_client_ip_no_proxies() -> Result<(), Box<dyn std::error::Error + 'static>> {
let _sys = actix::System::new();
let state = EndpointState::default();
assert_eq!(
state.trusted_proxies.len(),
0,
"Precondition: no trusted proxies by default"
);
let req = TestRequest::get()
.insert_header(("x-forwarded-for", "1.2.3.4, 5.6.7.8"))
.app_data(Data::new(state))
.to_http_request();
assert_eq!(
req.client_ip()?,
IpAddr::V4(Ipv4Addr::new(5, 6, 7, 8)),
"With no proxies, the right-most ip should be used"
);
Ok(())
}