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