Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Request Redirection Handling #348

merged 8 commits into from Dec 19, 2018

Handle double slashes in paths

  • Loading branch information...
jeffwecan committed Dec 7, 2018
commit a79c825eecaa02ecdc2483bff7f33b5db5f299d5
@@ -229,6 +229,9 @@ def request(self, method, url, headers=None, **kwargs):
:return: The response of the request.
:rtype: requests.Response
# Vault CLI treats a double forward slash ('//') as a single forward slash for a given path.
# To avoid issues with the requests module's redirection logic, we perform the same translation here.
url = url.replace('//', '/')
url = self.urljoin(self.base_uri, url)

if not headers:
@@ -35,6 +35,7 @@ class TestRequest(TestCase):
def test_get(self, label, url, path='v1/sys/health', redirect_url=None):
path = path.replace('//', '/')
expected_status_code = 200
mock_url = '{0}/{1}'.format(url, path)
adapter = adapters.Request(base_uri=url)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.