Skip to content

Commit 0abd1b0

Browse files
change from if statements to match statement
1 parent 02b85da commit 0abd1b0

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

crates/common/src/integrations/prebid.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -288,22 +288,17 @@ impl IntegrationProxy for PrebidIntegration {
288288
let path = req.get_path().to_string();
289289
let method = req.get_method().clone();
290290

291-
if method == Method::GET {
292-
if let Some(script_path) = &self.config.script_handler {
293-
if path == *script_path {
294-
return self.handle_script_handler();
295-
}
291+
match method {
292+
Method::GET if self.config.script_handler.as_ref() == Some(&path) => self.handle_script_handler(),
293+
Method::GET if path == ROUTE_FIRST_PARTY_AD => {
294+
self.handle_first_party_ad(settings, req).await
296295
}
297-
}
298-
299-
if method == Method::GET && path == ROUTE_FIRST_PARTY_AD {
300-
self.handle_first_party_ad(settings, req).await
301-
} else if method == Method::POST && path == ROUTE_THIRD_PARTY_AD {
302-
self.handle_third_party_ad(settings, req).await
303-
} else {
304-
Err(Report::new(Self::error(format!(
296+
Method::POST if path == ROUTE_THIRD_PARTY_AD => {
297+
self.handle_third_party_ad(settings, req).await
298+
}
299+
_ => Err(Report::new(Self::error(format!(
305300
"Unsupported Prebid route: {path}"
306-
))))
301+
)))),
307302
}
308303
}
309304
}

0 commit comments

Comments
 (0)