rename get as reqwest_blocking_get
This commit is contained in:
parent
d8861d6f7e
commit
d7729cc2a3
4 changed files with 8 additions and 9 deletions
|
@ -31,7 +31,7 @@ mod tests {
|
|||
//given
|
||||
let fetch_get = &(get as FetchGet);
|
||||
//when
|
||||
let result = find("site", "@channel", &fetch_get)?;
|
||||
let result = find("site", "@channel", fetch_get)?;
|
||||
//then
|
||||
assert_eq!(result, "the-rss-url");
|
||||
Ok(())
|
||||
|
@ -42,7 +42,7 @@ mod tests {
|
|||
//given
|
||||
let fetch_get = &(get as FetchGet);
|
||||
//when
|
||||
let result = find("site", "invalid-channel-name", &fetch_get);
|
||||
let result = find("site", "invalid-channel-name", fetch_get);
|
||||
//then
|
||||
assert!(result.is_err());
|
||||
Ok(())
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use atom_syndication::Feed;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
pub fn get(url: &str) -> Result<Feed> {
|
||||
use atom_syndication::Feed;
|
||||
|
||||
pub fn reqwest_blocking_get(url: &str) -> Result<Feed> {
|
||||
let content = reqwest::blocking::get(url)?.bytes()?;
|
||||
let channel = Feed::read_from(&content[..])?;
|
||||
Ok(channel)
|
||||
|
|
|
@ -5,10 +5,9 @@ use crate::fetch::FetchGet;
|
|||
mod find;
|
||||
mod get;
|
||||
|
||||
use atom_syndication::Feed;
|
||||
pub use find::find;
|
||||
pub use get::get;
|
||||
|
||||
type Feed = atom_syndication::Feed;
|
||||
pub use get::reqwest_blocking_get;
|
||||
|
||||
pub struct FeedEnv {
|
||||
pub find: FeedFind,
|
||||
|
|
|
@ -15,7 +15,7 @@ fn main() -> Result<()> {
|
|||
podal::Env {
|
||||
feed: FeedEnv {
|
||||
find: podal::feed::find,
|
||||
get: podal::feed::get,
|
||||
get: podal::feed::reqwest_blocking_get,
|
||||
},
|
||||
|
||||
history: HistoryEnv {
|
||||
|
|
Loading…
Add table
Reference in a new issue