Reputation: 942
I'm having problem downloading a file from URL using http.get. Response statusCode returns as 302, but when I try the same url with Firefox using HttpFox extension I can see a status code 200 and an additional header, "content-disposition: inline; filename=test.zip". Browsers handle these URL's correctly, and open a save as dialog. How should I handle this URL in Node.js?
Upvotes: 0
Views: 703
Reputation: 22951
"Response statusCode returns as 302" means redirect to another URL.
Browsers handles such response automatically. You have to do that by hands. The new URL is provided in the Location
header. Just do another http.get from this URL.
Upvotes: 1