Commit 5ebdbba7 authored by Terence Lee's avatar Terence Lee

fix test for port_in_redirect off

parent 2941d9c7
...@@ -65,10 +65,10 @@ RSpec.describe "Simple" do ...@@ -65,10 +65,10 @@ RSpec.describe "Simple" do
describe "redirects" do describe "redirects" do
let(:name) { "redirects" } let(:name) { "redirects" }
it "should redirect and respect the http code" do it "should redirect and respect the http code & remove the port" do
response = app.get("/old/gone") response = app.get("/old/gone")
expect(response.code).to eq("302") expect(response.code).to eq("302")
expect(response["location"]).to eq("http://#{AppRunner::HOST_IP}:#{AppRunner::HOST_PORT}/") expect(response["location"]).to eq("http://#{AppRunner::HOST_IP}/")
end end
end end
......
...@@ -54,8 +54,12 @@ class AppRunner ...@@ -54,8 +54,12 @@ class AppRunner
run do run do
network_retry(max_retries) do network_retry(max_retries) do
uri = URI("http://#{HOST_IP}:#{HOST_PORT}/#{path}") uri = URI("#{path}")
response = Net::HTTP.get_response(uri) uri.host = HOST_IP if uri.host.nil?
uri.port = HOST_PORT if (uri.host == HOST_IP && uri.port != HOST_PORT) || uri.port.nil?
uri.scheme = "http" if uri.scheme.nil?
response = Net::HTTP.get_response(URI(uri.to_s))
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment