src/basis/net/ajax.js
function setRequestHeaders(xhr, requestData){
    var headers = {};

    if (IS_METHOD_WITH_BODY.test(requestData.method))
    {
      // when send a FormData instance, browsers serialize it and
      // set correct content-type header with boundary
      if (!FormData || requestData.body instanceof FormData == false)
        headers['Content-Type'] = requestData.contentType + (requestData.encoding ? '\x3Bcharset=' + requestData.encoding : '');
    }
    else
    {
      if (ua.test('ie')) // disable IE caching
      {
        // new Date(0).toGMTString() is not correct here;
        // IE returns date string with no leading zero and IIS may parse
        // date wrong and response with code 400
        headers['If-Modified-Since'] = 'Thu, 01 Jan 1970 00:00:00 GMT';
      }
    }

    headers = basis.object.merge(headers, requestData.headers);

    objectIterate(requestData.headers, function(name, value){
      if (name.trim().toLowerCase() == 'content-type')
      {
        /** @cut */ basis.dev.warn('basis.net.ajax: `Content-Type` header found in request data, use contentType and encoding properties instead');
        headers['Content-Type'] = value;
      }
      else
        headers[name] = value;
    });

    objectIterate(headers, function(key, value){
      if (value != null && typeof value != 'function')
        xhr.setRequestHeader(key, value);
      else
        delete headers[key];
    });

    return headers;
  }
function setRequestHeaders(xhr, requestData){
    var headers = {};

    if (IS_METHOD_WITH_BODY.test(requestData.method))
    {
      // when send a FormData instance, browsers serialize it and
      // set correct content-type header with boundary
      if (!FormData || requestData.body instanceof FormData == false)
        headers['Content-Type'] = requestData.contentType + (requestData.encoding ? '\x3Bcharset=' + requestData.encoding : '');
    }
    else
    {
      if (ua.test('ie')) // disable IE caching
      {
        // new Date(0).toGMTString() is not correct here;
        // IE returns date string with no leading zero and IIS may parse
        // date wrong and response with code 400
        headers['If-Modified-Since'] = 'Thu, 01 Jan 1970 00:00:00 GMT';
      }
    }

    headers = basis.object.merge(headers, requestData.headers);

    objectIterate(requestData.headers, function(name, value){
      if (name.trim().toLowerCase() == 'content-type')
      {
        /** @cut */ basis.dev.warn('basis.net.ajax: `Content-Type` header found in request data, use contentType and encoding properties instead');
        headers['Content-Type'] = value;
      }
      else
        headers[name] = value;
    });

    objectIterate(headers, function(key, value){
      if (value != null && typeof value != 'function')
        xhr.setRequestHeader(key, value);
      else
        delete headers[key];
    });

    return headers;
  }
function setRequestHeaders ( xhr , requestData ) { var headers = { } ; if ( IS_METHOD_WITH_BODY . test ( requestData . method ) ) { // when send a FormData instance, browsers serialize it and // set correct content-type header with boundary if ( ! FormData || requestData . body instanceof FormData == false ) headers [ 'Content-Type' ] = requestData . contentType + ( requestData . encoding ? '\x3Bcharset=' + requestData . encoding : '' ) ; } else { if ( ua . test ( 'ie' ) ) // disable IE caching { // new Date(0).toGMTString() is not correct here; // IE returns date string with no leading zero and IIS may parse // date wrong and response with code 400 headers [ 'If-Modified-Since' ] = 'Thu, 01 Jan 1970 00:00:00 GMT' ; } } headers = basis . object . merge ( headers , requestData . headers ) ; objectIterate ( requestData . headers , function ( name , value ) { if ( name . trim ( ) . toLowerCase ( ) == 'content-type' ) { /** @cut */ basis . dev . warn ( 'basis.net.ajax: `Content-Type` header found in request data, use contentType and encoding properties instead' ) ; headers [ 'Content-Type' ] = value ; } else headers [ name ] = value ; } ) ; objectIterate ( headers , function ( key , value ) { if ( value != null && typeof value != 'function' ) xhr . setRequestHeader ( key , value ) ; else delete headers [ key ] ; } ) ; return headers ; }
Sets transport request headers
@private
Sets transport request headers