helpers/io-base.js
function (xhr, options, promise) {
            var instance = this,
                url = options.url,
                method = options.method || GET,
                headers = options.headers ? options.headers.itsa_deepClone() : {}, // all request will get some headers
                async = !options.sync,
                data = options.data,
                reject = promise.reject,
                sendPayload, additionalData;
            // xhr will be null in case of a CORS-request when no CORS is possible
            if (!xhr) {
                console.error(NAME, "_initXHR fails: "+ERROR_NO_XHR);
                reject(ERROR_NO_XHR);
                return;
            }
            // adding default headers (when set):
            headers.itsa_merge(instance._standardHeaders);

            // method-name should be in uppercase:
            method = method.toUpperCase();
            // in case of BODY-method: eliminate any data behind querystring:
            // else: append data-object behind querystring
            if (BODY_METHODS[method]) {
                url = url.split("?"); // now url is an array
                url[1] && (additionalData=instance._queryStringToDataObject(url[1]));
                if (additionalData && !additionalData.itsa_isEmpty()) {
                    data || (data={});
                    data.itsa_merge(additionalData);
                }
                url = url[0]; // now url is a String again
            }
            else if (data && (headers[CONTENT_TYPE]!==MIME_BLOB)) {
                url += (url.itsa_contains("?") ? "&" : "?") + instance._toQueryString(data);
            }

            xhr.open(method, url, async);
            options.responseType && (xhr.responseType=options.responseType);
            options.withCredentials && (xhr.withCredentials=true);


            // more initialisation might be needed by extended modules:
            instance._xhrInitList.forEach(
                function(fn) {
                    fn(xhr, promise, headers, method);
                }
            );

            if (BODY_METHODS[method] && data) {
                if (headers[CONTENT_TYPE]===MIME_BLOB) {
                    if (!xhr._isXDR) {
                        sendPayload = data;
                    }
                }
                else {
                    sendPayload = ((headers[CONTENT_TYPE]===MIME_JSON) || xhr._isXDR) ? JSON.stringify(data) : instance._toQueryString(data);
                }
            }
            // send the request:
            xhr.send(sendPayload);

            // now add xhr.abort() to the promise, so we can call from within the returned promise-instance
            promise.abort = function() {
                reject(ABORTED);
                xhr._aborted = true; // must be set: IE9 won"t allow to read anything on xhr after being aborted
                xhr.abort();
            };

            // in case synchronous transfer: force an xhr.onreadystatechange:
            async || xhr.onreadystatechange();
        }
function (xhr, options, promise) {
            var instance = this,
                url = options.url,
                method = options.method || GET,
                headers = options.headers ? options.headers.itsa_deepClone() : {}, // all request will get some headers
                async = !options.sync,
                data = options.data,
                reject = promise.reject,
                sendPayload, additionalData;
            // xhr will be null in case of a CORS-request when no CORS is possible
            if (!xhr) {
                console.error(NAME, "_initXHR fails: "+ERROR_NO_XHR);
                reject(ERROR_NO_XHR);
                return;
            }
            // adding default headers (when set):
            headers.itsa_merge(instance._standardHeaders);

            // method-name should be in uppercase:
            method = method.toUpperCase();
            // in case of BODY-method: eliminate any data behind querystring:
            // else: append data-object behind querystring
            if (BODY_METHODS[method]) {
                url = url.split("?"); // now url is an array
                url[1] && (additionalData=instance._queryStringToDataObject(url[1]));
                if (additionalData && !additionalData.itsa_isEmpty()) {
                    data || (data={});
                    data.itsa_merge(additionalData);
                }
                url = url[0]; // now url is a String again
            }
            else if (data && (headers[CONTENT_TYPE]!==MIME_BLOB)) {
                url += (url.itsa_contains("?") ? "&" : "?") + instance._toQueryString(data);
            }

            xhr.open(method, url, async);
            options.responseType && (xhr.responseType=options.responseType);
            options.withCredentials && (xhr.withCredentials=true);


            // more initialisation might be needed by extended modules:
            instance._xhrInitList.forEach(
                function(fn) {
                    fn(xhr, promise, headers, method);
                }
            );

            if (BODY_METHODS[method] && data) {
                if (headers[CONTENT_TYPE]===MIME_BLOB) {
                    if (!xhr._isXDR) {
                        sendPayload = data;
                    }
                }
                else {
                    sendPayload = ((headers[CONTENT_TYPE]===MIME_JSON) || xhr._isXDR) ? JSON.stringify(data) : instance._toQueryString(data);
                }
            }
            // send the request:
            xhr.send(sendPayload);

            // now add xhr.abort() to the promise, so we can call from within the returned promise-instance
            promise.abort = function() {
                reject(ABORTED);
                xhr._aborted = true; // must be set: IE9 won"t allow to read anything on xhr after being aborted
                xhr.abort();
            };

            // in case synchronous transfer: force an xhr.onreadystatechange:
            async || xhr.onreadystatechange();
        }
Initializes the xhr-instance, based on the config-params.
This method is the standard way of doing xhr-requests without processing streams.

@method _initXHR
@param xhr {Object} xhr-instance
@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.
This feature only works in the browser: nodejs will always perform asynchronous requests.
@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 fulfill {Function} reference to xhr-promise"s fulfill-function
@param reject {Function} reference to xhr-promise"s reject-function
@param promise {Promise} the xhr-promise which will be extended with the `abort()`-method
@private