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

How to figure out redirected URL? #45

Open
billiegoose opened this issue Dec 30, 2018 · 0 comments
Open

How to figure out redirected URL? #45

billiegoose opened this issue Dec 30, 2018 · 0 comments
Labels

Comments

@billiegoose
Copy link

billiegoose commented Dec 30, 2018

Since POST doesn't follow redirects (per design, see #35), I need to be able to detect when a redirect happens and figure out the new URL, so I can re-issue my POST request.

Actually, git does a GET request before each POST request, so I can probably detect the redirect from the first GET request and infer the new correct path for the POST request before I make it. But either way, basically I need to recover the new URL after redirection is resolved.

Here's what I have so far:

get('https://github.com/wmhilton/isomorphic-git', (err, res) => console.log(res.req.path))

That gets me the path, but I haven't figured out the best way to get the protocol/hostname/port.

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

2 participants