function createRequest (options) {
    var request = new XMLHttpRequest();

    options = options || {};
    merge(options, defaults);

    request.open({
        method: options.method,
        url: options.url,
        async: options.async,
        user: options.user,
        password: options.password
    });

    request.timeout = options.timeout || defaults.timeout;

    Object.keys(options.headers).forEach((key) => {
        request.setRequestHeader(key, options.headers[key]);
    });

    request.addEventListener('progress', options.onProgress);

    return request;
}
/**
 * Create and open an XMLHttpRequest based on the options given.
 * @param {Object} options Applied when opening and initializing the request
 * @returns {XMLHttpRequest} The created request
 */
Create and open an XMLHttpRequest based on the options given.
@param {Object} options Applied when opening and initializing the request
@returns {XMLHttpRequest} The created request
Create and open an XMLHttpRequest based on the options given . @param { Object } options Applied when opening and initializing the request @returns { XMLHttpRequest } The created request
function createRequest (options) {
    var request = new XMLHttpRequest();
    options = options || {};
    merge(options, defaults);
    request.open({
        method: options.method,
        url: options.url,
        async: options.async,
        user: options.user,
        password: options.password
    });
    request.timeout = options.timeout || defaults.timeout;
    Object.keys(options.headers).forEach((key) => {
        request.setRequestHeader(key, options.headers[key]);
    });
    request.addEventListener('progress', options.onProgress);
    return request;
}
function createRequest ( options ) { var request = new XMLHttpRequest ( ) ; options = options || { } ; merge ( options , defaults ) ; request . open ( { method : options . method , url : options . url , async : options . async , user : options . user , password : options . password } ) ; request . timeout = options . timeout || defaults . timeout ; Object . keys ( options . headers ) . forEach ( ( key ) => { request . setRequestHeader ( key , options . headers [ key ] ) ; } ) ; request . addEventListener ( 'progress' , options . onProgress ) ; return request ; }
Create and open an XMLHttpRequest based on the options given.
Create and open an XMLHttpRequest based on the options given .