Skip to content

Commit 2731281

Browse files
committed
do not return short redirect chains as test all rules errors
1 parent e18a7fe commit 2731281

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/api/redirection_loop.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ impl RedirectionLoop {
3434
pub fn has_error(&self) -> bool {
3535
self.error.is_some()
3636
}
37+
pub fn has_error_too_many_hops(&self) -> bool {
38+
self.error.is_some() && matches!(self.error, Some(RedirectionError::TooManyHops))
39+
}
40+
pub fn has_error_loop(&self) -> bool {
41+
self.error.is_some() && matches!(self.error, Some(RedirectionError::Loop))
42+
}
3743
fn compute(router: &Router<Rule>, max_hops: u8, example: &Example) -> RedirectionLoop {
3844
let mut current_url = example.url.clone();
3945
let mut current_method = example.method.clone().unwrap_or(String::from("GET"));

src/api/test_examples.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl TestExamplesOutput {
174174
} else {
175175
let redirection_loop = RedirectionLoop::from_example(router, max_hops, example);
176176

177-
if redirection_loop.has_error() {
177+
if redirection_loop.has_error_too_many_hops() || redirection_loop.has_error_loop(){
178178
results.add_failed_example(
179179
route.handler(),
180180
example.clone(),

0 commit comments

Comments
 (0)