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

Port is not being removed from URI in some cases #20

Open
zfletch opened this issue Aug 9, 2017 · 1 comment
Open

Port is not being removed from URI in some cases #20

zfletch opened this issue Aug 9, 2017 · 1 comment
Labels

Comments

@zfletch
Copy link
Contributor

zfletch commented Aug 9, 2017

The following test in uri_header_test.exs fails:

test "it removes the port part of the uri" do
  value = []
          |> HeaderValues.wrap()
          |> UriHeader.headers("example.com:8000/foo/bar")
          |> HeaderValues.get(:uri)

  assert value == "/foo/bar"
end
@zfletch zfletch added the bug label Aug 9, 2017
@zfletch
Copy link
Contributor Author

zfletch commented Feb 19, 2018

Note that the following test case succeeds:

test "it removes the port part of the uri" do
  value = []
          |> HeaderValues.wrap()
          |> UriHeader.headers("https://www.example.com:8000/foo/bar")
          |> HeaderValues.get(:uri)

  assert value == "/foo/bar"
end

Using the full URL (ie http://example.com instead of example.com) is a workaround. The issue stems from the way Elixir's URI library parses URLs. URI.parse("example.com:4000/foo") gives a path of "4000/foo" and a scheme of "example.com".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant