We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b46a587 commit d0e8c05Copy full SHA for d0e8c05
src/main.rs
@@ -216,15 +216,16 @@ fn heartbeat(req: &HttpRequest<State>) -> FutureResponse<HttpResponse> {
216
Ok(country_info) => country_info
217
.and_then(|country_info| country_info.country)
218
.and_then(|country| country.iso_code)
219
- .and_then(|iso_code| Some(Ok(iso_code == "US".to_string())))
+ .and_then(|iso_code| Some(Ok(iso_code == "US")))
220
.unwrap_or(Ok(false)),
221
Err(_) => Ok(false),
222
})
223
.or_else(|_| Ok(false))
224
.and_then(|res| {
225
- let mut resp = match res {
226
- true => HttpResponse::Ok(),
227
- false => HttpResponse::ServiceUnavailable(),
+ let mut resp = if res {
+ HttpResponse::Ok()
+ } else {
228
+ HttpResponse::ServiceUnavailable()
229
};
230
Ok(resp.json(HeartbeatResponse { geoip: res }))
231
}),
0 commit comments