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

Unclear on how to follow redirects when wrapping HTTPoison.Base #59

Closed
patrickbrown-dev opened this issue Jun 23, 2015 · 4 comments
Closed

Comments

@patrickbrown-dev
Copy link

I've been banging my head on this for a while, is it possible?

I'll make a PR with some docs on how to do it in the README once I know how, as I'm sure other people are wondering the same.

Thanks!

@edgurgel
Copy link
Owner

Oh hey! Yeah we should probably support a direct option instead of passing this through the hackney keyword. Here's an example on how to do it:

https://github.com/edgurgel/httpoison/blob/master/test/httpoison_test.exs#L67-L75

@fairbairn
Copy link

Can't quite tell how to get the location value back after the redirect. Is it possible to access the hackney.location value from the response object returned after it get request has occurred with hackney value of [ follow_redirect: true ] ?

@edgurgel
Copy link
Owner

edgurgel commented Nov 8, 2015

Hi @fairbairn, I think what you are looking for is being discussed here: #90 (comment)

@edgurgel edgurgel closed this as completed Nov 8, 2015
@sgnl
Copy link

sgnl commented Feb 15, 2019

here's a reference to following redirects in tests:

test "option follow redirect absolute url" do
assert_response(
HTTPoison.get(
"http://localhost:8080/redirect-to?url=http%3A%2F%2Flocalhost:8080%2Fget",
[],
follow_redirect: true
)
)
end
test "option follow redirect relative url" do
assert_response(
HTTPoison.get("http://localhost:8080/relative-redirect/1", [], follow_redirect: true)
)
end

the previous link by @edgurgel uses master so the link is outdated. The one I have here uses a blob commit hash instead of branch name

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

No branches or pull requests

4 participants