helpers/io-base.js
function(options) {
            var instance = this,
                props = {},
                xhr, promise;
            options = Object.itsa_isObject(options) ? options.itsa_deepClone() : {};
            promise = Promise.itsa_manage(options.streamback, options.stayActive);

            xhr = new XMLHttpRequest();
            props._isXHR2 = xhr2support;
            // it could be other modules like io-cors or io-stream have subscribed
            // xhr might be changed, also private properties might be extended
            instance._xhrList.forEach(
                function(fn) {
                    xhr = fn(xhr, props, options, promise);
                }
            );
            if (!xhr) {
                return Promise.reject(NO_XHR);
            }
            xhr.itsa_merge(props);

            // Don"t use xhr.timeout --> IE<10 throws an error when set xhr.timeout
            // We use a timer that aborts the request
            Object.defineProperty(xhr, "_timer", {
                configurable: false,
                enumerable: false,
                writable: false,
                value: setTimeout(function() {
                           promise.reject(REQUEST_TIMEOUT);
                           xhr._aborted = true; // must be set: IE9 won"t allow to read anything on xhr after being aborted
                           xhr.abort();
                       }, options.timeout || instance.config.timeout || DEF_REQ_TIMEOUT)
            });

            instance._initXHR(xhr, options, promise);

            // add to interbal hash:
            instance._runningRequests.push(promise);
            // remove it when ready:
            promise.itsa_finally(function() {
                instance._runningRequests.itsa_remove(promise);
            });

            return promise;
        }
function(options) {
            var instance = this,
                props = {},
                xhr, promise;
            options = Object.itsa_isObject(options) ? options.itsa_deepClone() : {};
            promise = Promise.itsa_manage(options.streamback, options.stayActive);

            xhr = new XMLHttpRequest();
            props._isXHR2 = xhr2support;
            // it could be other modules like io-cors or io-stream have subscribed
            // xhr might be changed, also private properties might be extended
            instance._xhrList.forEach(
                function(fn) {
                    xhr = fn(xhr, props, options, promise);
                }
            );
            if (!xhr) {
                return Promise.reject(NO_XHR);
            }
            xhr.itsa_merge(props);

            // Don"t use xhr.timeout --> IE<10 throws an error when set xhr.timeout
            // We use a timer that aborts the request
            Object.defineProperty(xhr, "_timer", {
                configurable: false,
                enumerable: false,
                writable: false,
                value: setTimeout(function() {
                           promise.reject(REQUEST_TIMEOUT);
                           xhr._aborted = true; // must be set: IE9 won"t allow to read anything on xhr after being aborted
                           xhr.abort();
                       }, options.timeout || instance.config.timeout || DEF_REQ_TIMEOUT)
            });

            instance._initXHR(xhr, options, promise);

            // add to interbal hash:
            instance._runningRequests.push(promise);
            // remove it when ready:
            promise.itsa_finally(function() {
                instance._runningRequests.itsa_remove(promise);
            });

            return promise;
        }
function ( options ) { var instance = this , props = { } , xhr , promise ; options = Object . itsa_isObject ( options ) ? options . itsa_deepClone ( ) : { } ; promise = Promise . itsa_manage ( options . streamback , options . stayActive ) ; xhr = new XMLHttpRequest ( ) ; props . _isXHR2 = xhr2support ; // it could be other modules like io-cors or io-stream have subscribed // xhr might be changed, also private properties might be extended instance . _xhrList . forEach ( function ( fn ) { xhr = fn ( xhr , props , options , promise ) ; } ) ; if ( ! xhr ) { return Promise . reject ( NO_XHR ) ; } xhr . itsa_merge ( props ) ; // Don"t use xhr.timeout --> IE<10 throws an error when set xhr.timeout // We use a timer that aborts the request Object . defineProperty ( xhr , "_timer" , { configurable : false , enumerable : false , writable : false , value : setTimeout ( function ( ) { promise . reject ( REQUEST_TIMEOUT ) ; xhr . _aborted = true ; // must be set: IE9 won"t allow to read anything on xhr after being aborted xhr . abort ( ) ; } , options . timeout || instance . config . timeout || DEF_REQ_TIMEOUT ) } ) ; instance . _initXHR ( xhr , options , promise ) ; // add to interbal hash: instance . _runningRequests . push ( promise ) ; // remove it when ready: promise . itsa_finally ( function ( ) { instance . _runningRequests . itsa_remove ( promise ) ; } ) ; return promise ; }
Sends a HTTP request to the server and returns a Promise with an additional .abort() method to cancel the request.
This method is the standard way of doing xhr-requests without processing streams.

@method request
@param options {Object}
@param [options.url] {String} The url to which the request is sent.
@param [options.method="GET"] {String} The HTTP method to use.
can be ignored, even if streams are used --> the returned Promise will always hold all data
@param [options.sync=false] {boolean} By default, all requests are sent asynchronously. To send synchronous requests, set to true.
@param [options.data] {Object} Data to be sent to the server, either to be used by `query-params` or `body`.
@param [options.headers] {Object} HTTP request headers.
@param [options.responseType] {String} Force the response type.
@param [options.timeout=3000] {number} to timeout the request, leading into a rejected Promise.
@param [options.withCredentials=false] {boolean} Whether or not to send credentials on the request.
@param [options.streamback] {Function} callbackfunction in case you want to process streams (needs io-stream module).
@param [options.stayActive] {Number} minimal time the request should be pending, even if IO has finished
@return {Promise} Promise holding the request. Has an additional .abort() method to cancel the request.
<ul>
<li>on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response</li>
<li>on failure: reason {Error}</li>
</ul>
Sends a HTTP request to the server and returns a Promise with an additional . abort () method to cancel the request . This method is the standard way of doing xhr - requests without processing streams .