rename get as reqwest_blocking_get
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful

This commit is contained in:
Paul Campbell 2023-07-26 21:25:14 +01:00
parent d8861d6f7e
commit d7729cc2a3
4 changed files with 8 additions and 9 deletions

View file

@ -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(())

View file

@ -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)

View file

@ -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,

View file

@ -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 {