Created
July 17, 2013 22:48
-
-
Save pierrevalade/6025241 to your computer and use it in GitHub Desktop.
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
// 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