facebook/javelin — pull request #19 by yliang6 (2012-06-13 01:13:06+00:00)
Title: Add CORS support and non-JSON response support to JX.Request

Summary:
CORS
- supports XHR w/ withCredentials and XDomainRequest as transport
- added a flag 'CORS' to toggle this

non-JSON response
- added a property responseType to allow 'JSON', 'TEXT' and 'XML' as the response type
- added a responseHandler property to handle response of non-JSON format

Test Plan:
1. rebuild packages;
2. go to sandbox page that loads javelin;
3. test request in chrome javascript console:

window['call_result'] = '';
var req = new JX.Request('http://bango.net/idxml/?bango=12345').setCORS(true).setMethod('GET').setExpectCSRFGuard(false).setResponseType('XML').setResponseHandler(function(resp){window.call_result = resp;});
req.send();

4. verified the request was sucessful and the result is expected.

Reviewers: jeffmo, vrana, epriestley, aran, leebyron, erling

Reviewed By: epriestley

CC: Korvin

Differential Revision: https://secure.phabricator.com/D2697