From 159fa74a3ffcd4f5bd7d5c200faefa30a4dd3242 Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Sun, 29 Oct 2023 22:46:45 +0000 Subject: [PATCH] add test to verify that redirect plugin can follow relative and with .. paths --- test/support/requests/plugins/follow_redirects.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/support/requests/plugins/follow_redirects.rb b/test/support/requests/plugins/follow_redirects.rb index 0e5078b2..7fb92f61 100644 --- a/test/support/requests/plugins/follow_redirects.rb +++ b/test/support/requests/plugins/follow_redirects.rb @@ -23,6 +23,16 @@ module Requests verify_status(response, 304) end + def test_plugin_follow_redirects_relative_path + session = HTTPX.plugin(:follow_redirects) + uri = redirect_uri("../get") + + redirect_response = session.get(uri) + body = json_body(redirect_response) + assert body.key?("url"), "url should be set" + assert body["url"] == redirect_location, "url should have been the given redirection url" + end + def test_plugin_follow_redirects_default_max_redirects session = HTTPX.plugin(:follow_redirects)