ttezel/twit — pull request #47 by mhkeller (2013-06-22 18:35:52+00:00)
Title: Add support for retweets

In the Twitter 1.1 API, retweets are signaled in the path of the call, with the tweet's ``id_str`` becoming a ``.json`` file. Example:
````
https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json
````
Currently, POST requests with Twit only add parameters after the ``.json`` preceded by a ``?``, the normal way parameters are passed through URLs. This obviously doesn't work with retweets where you want to pass in the ``id_str`` *before* the ``?``.

This pull request adds a function in ``twitter.js`` called ``checkForRetweet`` that checks whether the path passed to ``T.post`` is ``statuses/retweet``. If so, it adds the ``id_str'' as the name of the ``.json`` file in the request.

It preserves the ability to pass other params to the retweet POST request in the normal way that Twit takes all params as key-values in an object but sanitizes the param object by deleting the ``id`` key-value pair in ``normalizeParams()``.