Skip to content

Instantly share code, notes, and snippets.

@michaeltwofish
Created June 5, 2012 15:53
Show Gist options
  • Save michaeltwofish/2875890 to your computer and use it in GitHub Desktop.
Save michaeltwofish/2875890 to your computer and use it in GitHub Desktop.
var req = https.request( options, function( res ) {
var data = '';
res.on('data', function( chunk ) {
data += chunk;
});
res.on('end', function() {
try {
var parsed_data = JSON.parse( data );
if ( parsed_data.fields ) {
msg.say( issue + " Status: " + parsed_data.fields.status.value.name );
msg.say( "Summary: " + parsed_data.fields.summary.value );
msg.say( "Issue URL: " + issue_url + " API URL: " + parsed_data.self );
}
else if ( parsed_data.errorMessages ) {
msg.say( parsed_data.errorMessages[0] );
}
} catch (e) {
msg.say( "Could not parse response. You might try " + issue_url );
return;
}
});
});
req.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment