diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/fallback.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/modules/fallback.rs b/src/modules/fallback.rs index b0deed1..6a5caaa 100644 --- a/src/modules/fallback.rs +++ b/src/modules/fallback.rs @@ -36,7 +36,7 @@ impl Node for Fallback { for (i, h) in self.0.iter().enumerate() { let last = i == self.0.len() - 1; - let resp = h + let res = h .handle( context, Request::from_parts( @@ -44,13 +44,17 @@ impl Node for Fallback { BoxBody::new(Full::new(body.clone()).map_err(|x| match x {})), ), ) - .await?; - if resp.status().is_success() - || resp.status().is_redirection() - || resp.status().is_informational() - || last - { - return Ok(resp); + .await; + if last { + return res; + } + if let Ok(resp) = res { + if resp.status().is_success() + || resp.status().is_redirection() + || resp.status().is_informational() + { + return Ok(resp); + } } } return Err(ServiceError::CustomStatic( |