Skip to content

Instantly share code, notes, and snippets.

@pierrevalade
Created July 17, 2013 22:48
Show Gist options
  • Save pierrevalade/6025241 to your computer and use it in GitHub Desktop.
Save pierrevalade/6025241 to your computer and use it in GitHub Desktop.
// Twitter Issue (Can't tweet exclamation mark with v1.1)
// https://dev.twitter.com/discussions/12378
// https://github.com/mikeal/request/issues/578
var escape = function(str) {
return encodeURIComponent(str).replace(/[!*()']/g, function(character) {
return '%' + character.charCodeAt(0).toString(16);
});
};
var tweet = '!!!';
var options = {
method: 'POST',
url: ['https://api.twitter.com/1.1/statuses/update.json?status=', escape(tweet)].join(''),
json: true
};
request(options, function(...))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment