diff --git a/ethers-etherscan/src/errors.rs b/ethers-etherscan/src/errors.rs index 2ff4d0c6..f840cc57 100644 --- a/ethers-etherscan/src/errors.rs +++ b/ethers-etherscan/src/errors.rs @@ -47,3 +47,15 @@ pub enum EtherscanError { pub(crate) fn is_blocked_by_cloudflare_response(txt: &str) -> bool { txt.to_lowercase().contains("sorry, you have been blocked") } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_cloudflare_response() { + let resp = "\n\n\n\n \n
\nThis website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.
\nYou can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.
\n