lib/plugins/XMLHttpRequestPlugin.js
function setXHRConfig (req, config) {
  try {
    req.withCredentials = config.http.withCredentials;
  }
  catch (err) {
    // Some browsers don't allow `withCredentials` to be set for synchronous requests
  }

  try {
    req.timeout = config.http.timeout;
  }
  catch (err) {
    // Some browsers don't allow `timeout` to be set for synchronous requests
  }

  // Set request headers
  Object.keys(config.http.headers).forEach(function (key) {
    var value = config.http.headers[key];
    if (value !== undefined) {
      req.setRequestHeader(key, value);
    }
  });
}
function setXHRConfig (req, config) {
  try {
    req.withCredentials = config.http.withCredentials;
  }
  catch (err) {
    // Some browsers don't allow `withCredentials` to be set for synchronous requests
  }

  try {
    req.timeout = config.http.timeout;
  }
  catch (err) {
    // Some browsers don't allow `timeout` to be set for synchronous requests
  }

  // Set request headers
  Object.keys(config.http.headers).forEach(function (key) {
    var value = config.http.headers[key];
    if (value !== undefined) {
      req.setRequestHeader(key, value);
    }
  });
}
function setXHRConfig ( req , config ) { try { req . withCredentials = config . http . withCredentials ; } catch ( err ) { // Some browsers don't allow `withCredentials` to be set for synchronous requests } try { req . timeout = config . http . timeout ; } catch ( err ) { // Some browsers don't allow `timeout` to be set for synchronous requests } // Set request headers Object . keys ( config . http . headers ) . forEach ( function ( key ) { var value = config . http . headers [ key ] ; if ( value !== undefined ) { req . setRequestHeader ( key , value ) ; } } ) ; }
Sets the XMLHttpRequest properties, per the specified configuration.

@param {XMLHttpRequest} req
@param {Config} config
Sets the XMLHttpRequest properties per the specified configuration .