ded/reqwest — pull request #53 by rvagg (2011-10-09 10:29:56+00:00)
Title: JSONP cleanup

Issue #7 from @akovalev seemed like a good excuse to have a go at cleaning up the JSONP code.

* Proper JSONP mime-type handling on test server and also an 'echo' query-string parameter that switches on an echo-mode instead of spitting out a file. Currently designed for JSONP or JSON testing but it could be expanded.
* Got rid of `getCallbackName()` and introduced a new `handleJsonp()` that does the bulk of the JSONP work itself.
* `getRequest()` delegates JSONP requests to `handleJsonp()` *after* fixing the URL with the `data` parameter, so it's no longer ignored as per issue #7.
* Some minor bugs in the JSONP handling I picked up as I was hacking away
* Introduced a `jsonpCallbackName` option key that will set the callback function name rather than either using the randomly generated function name or the function name extracted from the existing query-string. So you can now specify the callback query-string parameter key and the value for it with options.

Something important to note though, I think the existing `jsonpCallback` option conflicts with the equivalent jQuery option which does it the other way around. The 2 jQuery options appear to be `jsonp` for the callback query-string *key* and `jsonpCallback` for the query-string *value*. Whereas Reqwest does `jsonpCallback` for the *key* and now `jsonpCallbackName` for the *value*. Though I'm not sure how important that is.

Tests pass in the usual; IE6+, FF3+, etc.