示例#1
0
文件: xdr.js 项目: Snger/kissy
 runs(function () {
     io.setupConfig({
         headers: {
             'X-Requested-With': 'XMLHttpRequest'
         }
     });
 });
示例#2
0
文件: xdr.js 项目: Snger/kissy
        it('support ignore X-Requested-With for all request', function () {
            var ok = 0;

            io.setupConfig({
                headers: {
                    'X-Requested-With': false
                }
            });

            io({
                cache: false,
                dataType: 'json',
                url: testUrl,
                xhrFields: {
                    withCredentials: true
                },
                xdr: {
                    // force to use native xhr no sub domain proxy
                    subDomain: {
                        proxy: false
                    }
                },
                success: function (d) {
                    expect('X-Requested-With' in d).toBe(false);
                    ok = 1;
                }
            });

            waitsFor(function () {
                return ok;
            });

            runs(function () {
                io.setupConfig({
                    headers: {
                        'X-Requested-With': 'XMLHttpRequest'
                    }
                });
            });
        });