@@ -613,6 +613,7 @@ public function testGetIPAddressThruProxy()
613613 $ config ->proxyIPs = '10.0.1.200,192.168.5.0/24 ' ;
614614 $ _SERVER ['HTTP_X_FORWARDED_FOR ' ] = $ expected ;
615615 $ this ->request = new Request ($ config );
616+ $ this ->request ->populateHeaders ();
616617
617618 // we should see the original forwarded address
618619 $ this ->assertSame ($ expected , $ this ->request ->getIPAddress ());
@@ -626,6 +627,7 @@ public function testGetIPAddressThruProxyInvalid()
626627 $ config ->proxyIPs = '10.0.1.200,192.168.5.0/24 ' ;
627628 $ _SERVER ['HTTP_X_FORWARDED_FOR ' ] = $ expected ;
628629 $ this ->request = new Request ($ config );
630+ $ this ->request ->populateHeaders ();
629631
630632 // spoofed address invalid
631633 $ this ->assertSame ('10.0.1.200 ' , $ this ->request ->getIPAddress ());
@@ -639,6 +641,7 @@ public function testGetIPAddressThruProxyNotWhitelisted()
639641 $ config ->proxyIPs = '10.0.1.200,192.168.5.0/24 ' ;
640642 $ _SERVER ['HTTP_X_FORWARDED_FOR ' ] = $ expected ;
641643 $ this ->request = new Request ($ config );
644+ $ this ->request ->populateHeaders ();
642645
643646 // spoofed address invalid
644647 $ this ->assertSame ('10.10.1.200 ' , $ this ->request ->getIPAddress ());
@@ -652,6 +655,7 @@ public function testGetIPAddressThruProxySubnet()
652655 $ config ->proxyIPs = ['192.168.5.0/24 ' ];
653656 $ _SERVER ['HTTP_X_FORWARDED_FOR ' ] = $ expected ;
654657 $ this ->request = new Request ($ config );
658+ $ this ->request ->populateHeaders ();
655659
656660 // we should see the original forwarded address
657661 $ this ->assertSame ($ expected , $ this ->request ->getIPAddress ());
@@ -665,6 +669,7 @@ public function testGetIPAddressThruProxyOutofSubnet()
665669 $ config ->proxyIPs = ['192.168.5.0/28 ' ];
666670 $ _SERVER ['HTTP_X_FORWARDED_FOR ' ] = $ expected ;
667671 $ this ->request = new Request ($ config );
672+ $ this ->request ->populateHeaders ();
668673
669674 // we should see the original forwarded address
670675 $ this ->assertSame ('192.168.5.21 ' , $ this ->request ->getIPAddress ());
0 commit comments