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

Handle moved repo(301 redirect) #257

Closed
PeterDaveHello opened this issue May 30, 2015 · 6 comments
Closed

Handle moved repo(301 redirect) #257

PeterDaveHello opened this issue May 30, 2015 · 6 comments

Comments

@PeterDaveHello
Copy link

Seems currently can not handle moved repo, hope it can be supported, thanks!

@dominicbarnes
Copy link

+1

@jamestalmage
Copy link

According to the spec, all redirects should be followed.

API v3 uses HTTP redirection where appropriate. Clients should assume that any request may result in a redirection. Receiving an HTTP redirection is not an error and clients should follow that redirect.
...
Other redirection status codes may be used in accordance with the HTTP 1.1 spec.

follow-redirects may provide a simple solution. Unfortunately, it currently has a dependency on underscore which adds a whole bunch of bulk we don't want if we are running in a browser. I have raised an issue to get underscore removed, and will likely create a PR to address that.

@zenorocha
Copy link

GitHub officially turned that on and my app broke: https://developer.github.com/changes/2015-07-21-automatic-redirects-for-renamed-repositories

Would be awesome if this was built-in on node-github @mikedeboer.

@podviaznikov
Copy link

+1 would love to see fix for this in the node-github

@jamestalmage
Copy link

I would recommend follow-redirects. Should be a drop in replacement for http. The underscore dependency is gone, but that does not really impact the browser anyways. Browsers automatically follow redirects, so we recommend having browserify just replace follow-redirects with vanilla http during bundling.

There is still one issue. It may affect non-GET requests that are redirected with 307. I just picked that back up this afternoon and should be close to a resolution within a day or two.

@jamestalmage
Copy link

@podviaznikov @zenorocha
Can you try #284 and see if it fixes your issue?

It is probably only a partial fix. I will be improving follow-redirects in the coming days, which should hopefully fix everything.

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

5 participants