moocat
February 18, 2015, 11:01am
5
If you are already using JQuery I highly recommend just doing your requests through that and ditching that old and, excuse my language, piece of garbage JS SDK.
if (!Twitch._config.session) {
throw new Error('You must call init() before api()');
}
var params = options.params || {};
callback = callback || function() {};
var authenticated = !!Twitch._config.session.token,
url = Twitch.baseUrl + (options.url || options.method || '');
if (authenticated) params.oauth_token = Twitch._config.session.token;
if (options.verb) params._method = options.verb;
// When using JSONP, any error response will have a
// `200` HTTP status code with the actual code in the body
// so we can parse them.
$.ajax({
url: url + '?' + $.param(params),
dataType: 'jsonp',
timeout : REQUEST_TIMEOUT
})
Seriously. Just use the “_method” param instead.