Instead of using what you are using try the request module instead
Heres a sample use. (It’s for converting a twitch name to it’s cased user set version)
request('https://api.twitch.tv/kraken/users/' + who.toLowerCase(), function (error, response, body) {
if (error) {
console.log(error);
} else if (response.statusCode != 200) {
console.log('HTTP: ' + response.statusCode);
} else {
try {
body = JSON.parse(body);
who = body.display_name;
} catch (Err) {
console.log('JSON Parse Error: ' + err);
}
}
// do something with who
});