File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1663,6 +1663,32 @@ def test_session_get_adapter_prefix_matching_is_case_insensitive(self):
1663
1663
1664
1664
assert s .get_adapter (url_matching_prefix_with_different_case ) is my_adapter
1665
1665
1666
+ def test_session_get_adapter_prefix_with_trailing_slash (self ):
1667
+ # from issue #6935
1668
+ prefix = "https://example.com/" # trailing slash
1669
+ url_matching_prefix = "https://example.com/some/path"
1670
+ url_not_matching_prefix = "https://example.com.other.com/some/path"
1671
+
1672
+ s = requests .Session ()
1673
+ adapter = HTTPAdapter ()
1674
+ s .mount (prefix , adapter )
1675
+
1676
+ assert s .get_adapter (url_matching_prefix ) is adapter
1677
+ assert s .get_adapter (url_not_matching_prefix ) is not adapter
1678
+
1679
+ def test_session_get_adapter_prefix_without_trailing_slash (self ):
1680
+ # from issue #6935
1681
+ prefix = "https://example.com" # no trailing slash
1682
+ url_matching_prefix = "https://example.com/some/path"
1683
+ url_extended_hostname = "https://example.com.other.com/some/path"
1684
+
1685
+ s = requests .Session ()
1686
+ adapter = HTTPAdapter ()
1687
+ s .mount (prefix , adapter )
1688
+
1689
+ assert s .get_adapter (url_matching_prefix ) is adapter
1690
+ assert s .get_adapter (url_extended_hostname ) is adapter
1691
+
1666
1692
def test_header_remove_is_case_insensitive (self , httpbin ):
1667
1693
# From issue #1321
1668
1694
s = requests .Session ()
You can’t perform that action at this time.
0 commit comments