Hey guys, I'm attempting to perform a simple HTTP request against a
remote server that I have no control over whatsoever. I'm expecting
the request to return a 302 redirect to another URL, but instead Node
keeps on crashing on me when trying to parse the response:
events:12
throw arguments[1];
^
Error: Parse Error
at Client.ondata (http:881:22)
at IOWatcher.callback (net:517:29)
at node.js:773:9
Here's the code I'm trying. Almost a copy & paste of the google
example on the API page:
http://gist.github.com/531588
I am able to paste the URL into Chrome and it redirects to the
expected URL.
I am thinking that this is happening due to a sloppy response from the
server (I noticed that there's a bunch of spaces after a bunch of the
header values before the \r\n), and that possibly Node should be a bit
more lenient about this kind of response so that the coder can do
something with it.
Also, I know that the response it coming back ok because I can see it
and it's 302 status and it's redirected URL through Wireshark, but
Node it choking while parsing it seems. Thanks in advance!