-
Notifications
You must be signed in to change notification settings - Fork 156
Handling GitHub Redirects #122
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
Conversation
c83293e to
2e3bb54
Compare
2e3bb54 to
bb092f1
Compare
| use_cassette "members#member_" do | ||
| assert member?("elixir-conspiracy", "josephwilk", @client) == {302, nil} | ||
| {status_code, _} = member?("elixir-conspiracy", "josephwilk", @client) | ||
| assert status_code == 404 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@duksis since now we are redirecting automatically, the result of this method had to change , this will "brake" compatibility but in my opinion makes more sense, WDYT ?
I mocked the scenario: "Response if requester is not an organization member and is inquiring about themselves", I tried to be consistent with the fixtures from other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by "brake" you mean the fact that it won't return the 30x statuses anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I mean the developers that are handling themselves the 30x (not sure is happening)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even for those It should not be a breaking change.
| resp = request!(method, url, JSX.encode!(body), authorization_header(auth, extra_headers() ++ @user_agent), extra_options()) | ||
| case process_response(resp) do | ||
| {status, redirect_response} when status in [301, 302, 307] -> redirect_response | ||
| request_with_pagination(method, location_header(resp), auth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something is weird with the indentation here @micheldoumit and also there is this warning now during compilation https://travis-ci.org/edgurgel/tentacat/jobs/273683374#L710
1 similar comment
|
Thanks @micheldoumit ! closes #121 |
Issue: #121
Github can return redirect responses in some cases like when a repository is renamed, this PR will address that by handling 301, 302 and 307 responses which are documented here