Skip to content

Commit

Permalink
- Remove now unneeded numeric comparisons for HTTP response codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Edu4rdSHL committed Jan 12, 2020
1 parent 3300ff7 commit 7da5730
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,16 +730,13 @@ fn subdomains_alerts(args: &mut args::Args) -> Result<()> {
if !webhook.is_empty() {
let response = CLIENT.post(webhook).json(&webhooks_payload).send()?;
if response.status().is_success()
|| response.status() == 204
&& !new_subdomains.is_empty()
&& commit_to_db_counter == 0
&& !new_subdomains.is_empty()
&& commit_to_db_counter == 0
{
if commit_to_db(&connection, &new_subdomains).is_ok() {
commit_to_db_counter += 1
}
} else if response.status().is_success()
|| response.status() == 204 && new_subdomains.is_empty()
{
} else if response.status().is_success() && new_subdomains.is_empty() {
} else if !args.quiet_flag {
eprintln!(
"\nAn error occurred when Findomain tried to publish the data to the following webhook {}. \nError description: {}",
Expand Down
2 changes: 1 addition & 1 deletion src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pub fn check_http_response_code(
response: &reqwest::Response,
quiet_flag: bool,
) -> bool {
if response.status() == 200 {
if response.status().is_success() {
true
} else {
if !quiet_flag {
Expand Down

0 comments on commit 7da5730

Please sign in to comment.