Fmt.
This commit is contained in:
@@ -7,15 +7,18 @@ pub struct KonsumentInfo;
|
||||
impl Probe for KonsumentInfo {
|
||||
fn search(&mut self, ctx: &mut Context, number: &str) {
|
||||
let body = if let Some(cache) = ctx.cache_get("konsument_info", &number) {
|
||||
String::from_utf8(cache.data)
|
||||
.unwrap()
|
||||
String::from_utf8(cache.data).unwrap()
|
||||
} else {
|
||||
reqwest::get(&format!("http://konsumentinfo.se/telefonnummer/sverige/{}", number))
|
||||
.unwrap()
|
||||
.text()
|
||||
.unwrap()
|
||||
reqwest::get(&format!(
|
||||
"http://konsumentinfo.se/telefonnummer/sverige/{}",
|
||||
number
|
||||
))
|
||||
.unwrap()
|
||||
.text()
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
ctx.cache_set("konsument_info", &number, body.as_bytes()).expect("wut?! why not?!");
|
||||
ctx.cache_set("konsument_info", &number, body.as_bytes())
|
||||
.expect("wut?! why not?!");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user