mirror of
https://github.com/icewind1991/warp-real-ip.git
synced 2026-06-03 18:54:06 +02:00
minor cleanup
This commit is contained in:
parent
5c5a36bdbe
commit
3f6837c87c
2 changed files with 68 additions and 25 deletions
|
|
@ -83,3 +83,25 @@ async fn test_trusted_forwarded_no_for() {
|
|||
.await;
|
||||
assert_eq!(res.body(), "1.2.3.4");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_quoted() {
|
||||
let remote: IpAddr = [1, 2, 3, 4].into();
|
||||
let res = warp::test::request()
|
||||
.remote_addr((remote, 80).into())
|
||||
.header("x-forwarded-for", "\"10.10.10.10\"")
|
||||
.reply(&serve(vec![remote]))
|
||||
.await;
|
||||
assert_eq!(res.body(), "10.10.10.10");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_nested_quoted() {
|
||||
let remote: IpAddr = [1, 2, 3, 4].into();
|
||||
let res = warp::test::request()
|
||||
.remote_addr((remote, 80).into())
|
||||
.header("x-forwarded-for", "\"10.10.10.10\", 11.11.11.11")
|
||||
.reply(&serve(vec![remote, [10, 10, 10, 10].into()]))
|
||||
.await;
|
||||
assert_eq!(res.body(), "11.11.11.11");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue