Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ pub struct Slack {
impl Slack {
/// Construct a new instance of slack for a specific incoming url endpoint.
pub fn new<T: reqwest::IntoUrl>(hook: T) -> Result<Slack> {
Ok(Slack {
hook: hook.into_url()?,
client: Client::new(),
})
Self::new_with_client(hook, Client::new())
}

/// The same as [`Slack::new()`], but with a custom [`reqwest::Client`]
///
/// This allows for configuring custom proxies, DNS resolvers, etc.
pub fn new_with_client<T: reqwest::IntoUrl>(hook: T, client: Client) -> Result<Self> {
let hook = hook.into_url()?;
Ok(Self { hook, client })
}

/// Send payload to slack service
Expand Down
13 changes: 9 additions & 4 deletions src/slack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ pub struct Slack {
impl Slack {
/// Construct a new instance of slack for a specific incoming url endpoint.
pub fn new<T: reqwest::IntoUrl>(hook: T) -> Result<Slack> {
Ok(Slack {
hook: hook.into_url()?,
client: Client::new(),
})
Self::new_with_client(hook, Client::new())
}

/// The same as [`Slack::new()`], but with a custom [`reqwest::Client`]
///
/// This allows for configuring custom proxies, DNS resolvers, etc.
pub fn new_with_client<T: reqwest::IntoUrl>(hook: T, client: Client) -> Result<Self> {
let hook = hook.into_url()?;
Ok(Self { hook, client })
}

/// Send payload to slack service
Expand Down