Skip to content

Commit

Permalink
use Option<&T> instead of &Option<T> for maybe_get_forwarded
Browse files Browse the repository at this point in the history
  • Loading branch information
NexVeridian committed Dec 2, 2024
1 parent 83dae54 commit a3e031f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controller/middleware/remote_ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,15 @@ mod tests {
assert_debug_snapshot!(res);
let res = maybe_get_forwarded(
&xff("51.50.51.50,192.1.1.1"),
Some(&vec![IpNetwork::from_str("192.1.1.1/8").unwrap()]),
Some(vec![IpNetwork::from_str("192.1.1.1/8").unwrap()]).as_ref(),
);
assert_debug_snapshot!(res);

// we replaced the proxy list, which is why 192.168.1.1 should appear as a valid
// remote IP and not skipped
let res = maybe_get_forwarded(
&xff("51.50.51.50,192.168.1.1"),
Some(&vec![IpNetwork::from_str("192.1.1.1/16").unwrap()]),
Some(vec![IpNetwork::from_str("192.1.1.1/16").unwrap()]).as_ref(),
);
assert_debug_snapshot!(res);
}
Expand Down

0 comments on commit a3e031f

Please sign in to comment.