GitHub release asset download with node.js

544 views Asked by At

I want to write an auto downloader in Node.js using the http.get method from a GitHub release using the API and and i receive 302 error. What can i do?

1

There are 1 answers

1
Chris On BEST ANSWER

HTTP 302 isn't an error:

The HTTP response status code 302 Found is a common way of performing URL redirection.

You can handle HTTP 302 Found by retrieving the URL shown in the Location response header.

Instead of using http.get, you might want to consider using the request library as suggested in this answer. request should automatically follow the redirect.