Code coverage report for lib/prequest.js

Statements: 66.67% (4 / 6)      Branches: 25% (2 / 8)      Functions: 100% (1 / 1)      Lines: 66.67% (4 / 6)      Ignored: none     

All files » lib/ » prequest.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18    1   1         21873           21873    
'use strict';
 
var ajax = require('./deps/ajax');
 
module.exports = function(opts, callback) {
 
  // cache-buster, specifically designed to work around IE's aggressive caching
  // see http://www.dashbay.com/2011/05/internet-explorer-caches-ajax/
  // Also Safari caches POSTs, so we need to cache-bust those too.
  Iif (process.browser &&
      (opts.method === 'POST' || opts.method === 'GET') && !opts.cache) {
    var hasArgs = opts.url.indexOf('?') !== -1;
    opts.url += (hasArgs ? '&' : '?') + '_nonce=' + Date.now();
  }
 
  return ajax(opts, callback);
};