edgurgel / edgurgel/httpoison

When following redirects, I'd like to be able to access the final location

Open
#90 13 comments 5 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
2.3k
Forks
349
PR merge metrics
No merged PRs in 30d

Description

As it stands now, following a redirect only returns the final response, and there is no way to determine what URL that response maps to. For example, the following call hits `tinfoil-fake-site.com`, but follows a redirect, and ends up on `https://tinfoilsecurity.com`

```
HTTPoison.request(:get, "tinfoil-fake-site.com", "", [], [hackney: [{:follow_redirect, true}]])
```

Since the final response does not have a location header (As it shouldn't!), we have no way of determining what page we ended up on.

[The Hackney documentation](https://github.com/benoitc/hackney#automatically-follow-a-redirection) claims that the "Last Location is stored in the location property of the client state," but I don't believe we have access to this from `HTTPoison`.

I'll let you know if I find a way of accessing this information. I'm also happy to contribute a fix upstream if you have any ideas on a possible solution!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.