Fix #87: pick up IP in US for heartbeat
This commit is contained in:
Родитель
0f52d0dd98
Коммит
52c1e76478
|
@ -114,7 +114,7 @@ mod tests {
|
|||
.route("/", web::get().to(super::classify_client)),
|
||||
);
|
||||
|
||||
let request = TestRequest::with_header("x-forwarded-for", "1.2.3.4").to_request();
|
||||
let request = TestRequest::with_header("x-forwarded-for", "7.7.7.7").to_request();
|
||||
let value: serde_json::Value = test::read_response_json(&mut service, request);
|
||||
assert_eq!(
|
||||
*value.get("country").unwrap(),
|
||||
|
|
|
@ -17,7 +17,7 @@ struct HeartbeatResponse {
|
|||
}
|
||||
|
||||
pub fn heartbeat(app_data: Data<EndpointState>) -> Result<HttpResponse, ClassifyError> {
|
||||
let ip = IpAddr::V4(Ipv4Addr::new(1, 2, 3, 4));
|
||||
let ip = IpAddr::V4(Ipv4Addr::new(7, 7, 7, 7));
|
||||
|
||||
app_data
|
||||
.geoip
|
||||
|
|
|
@ -114,7 +114,7 @@ mod tests {
|
|||
.path("./GeoLite2-Country.mmdb")
|
||||
.build()?;
|
||||
|
||||
let ip = "1.2.3.4".parse()?;
|
||||
let ip = "7.7.7.7".parse()?;
|
||||
let rv = geoip.locate(ip).unwrap().unwrap();
|
||||
assert_eq!(rv.country.unwrap().iso_code.unwrap(), "US");
|
||||
Ok(())
|
||||
|
@ -129,7 +129,7 @@ mod tests {
|
|||
.metrics(metrics)
|
||||
.build()?;
|
||||
|
||||
geoip.locate("1.2.3.4".parse()?)?;
|
||||
geoip.locate("7.7.7.7".parse()?)?;
|
||||
geoip.locate("127.0.0.1".parse()?)?;
|
||||
|
||||
assert_eq!(
|
||||
|
|
Загрузка…
Ссылка в новой задаче