diff --git a/src/finder/header_finder.rs b/src/finder/header_finder.rs
index a30e5a5..670aa7f 100644
--- a/src/finder/header_finder.rs
+++ b/src/finder/header_finder.rs
@@ -78,85 +78,71 @@ mod tests {
use salvo_core::http::HeaderValue;
#[tokio::test]
- async fn test_captcha_header_finder() {
- let finder = CaptchaHeaderFinder::new();
+ #[rstest::rstest]
+ #[case::not_found(None, None, None, None, None, None)]
+ #[case::normal(
+ None,
+ None,
+ Some(("x-captcha-token", "token")),
+ Some(("x-captcha-answer", "answer")),
+ Some(Some("token")),
+ Some(Some("answer"))
+ )]
+ #[case::custom_headers(
+ Some("custom-token"),
+ Some("custom-answer"),
+ Some(("custom-token", "token")),
+ Some(("custom-answer", "answer")),
+ Some(Some("token")),
+ Some(Some("answer"))
+ )]
+ #[case::custom_not_found(Some("custom-token"), Some("custom-answer"), None, None, None, None)]
+ #[case::custom_not_found_with_headers(
+ Some("custom-token"),
+ Some("custom-answer"),
+ Some(("x-captcha-token", "token")),
+ Some(("x-captcha-answer", "answer")),
+ None,
+ None
+ )]
+ async fn test_header_finder(
+ #[case] custom_token_header: Option<&'static str>,
+ #[case] custom_answer_header: Option<&'static str>,
+ #[case] token_header_name_value: Option<(&'static str, &'static str)>,
+ #[case] answer_header_name_value: Option<(&'static str, &'static str)>,
+ #[case] excepted_token: Option