Created
May 30, 2014 18:05
-
-
Save sandinmyjoints/3c9f1f6fa4ed047a2237 to your computer and use it in GitHub Desktop.
Control character causes socket hang up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require("http"); | |
var query = 'ningun'; | |
http.get("http://127.0.0.1:2000/api/v1/dictionary?q=" + query + "&source=en", function(res) { | |
res.setEncoding('utf8'); | |
var content = ''; | |
res.on('data', function (chunk) { | |
console.log("res.on data"); | |
content += chunk; | |
}); | |
res.on('end', function () { | |
console.log("res.on end: ", content); | |
}); | |
res.on('error', function (err) { | |
console.log('res.on error: ', err); | |
}); | |
}).on('error', function(err) { | |
console.log("http.get.on error: ", err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment