Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_getUrlForSend: function () {
// for compatible, some server does not decode query
// uri will encode query
// x.html?t=1,2
// =>
// x.html?t=1%3c2
// so trim original query when process other query
// and append when send
var c = this.config,
uri = c.uri;
var search = uri.search || '';
delete uri.search;
if (search && !util.isEmptyObject(uri.query)) {
search = '&' + search.substring(1);
}
return url.stringify(uri, c.serializeArray) + search;
}
}
function getIfModifiedKey(c) {
var ifModified = c.ifModified,
ifModifiedKey;
if (ifModified) {
ifModifiedKey = c.uri;
if (c.cache === false) {
ifModifiedKey = util.clone(ifModifiedKey);
// remove random timestamp
// random timestamp is forced to fetch code file from server
delete ifModifiedKey.query._ksTS;
}
ifModifiedKey = url.stringify(ifModifiedKey);
}
return ifModifiedKey;
}
function getIfModifiedKey(c) {
var ifModified = c.ifModified,
ifModifiedKey;
if (ifModified) {
ifModifiedKey = c.uri;
if (c.cache === false) {
ifModifiedKey = util.clone(ifModifiedKey);
// remove random timestamp
// random timestamp is forced to fetch code file from server
delete ifModifiedKey.query._ksTS;
}
ifModifiedKey = url.stringify(ifModifiedKey);
}
return ifModifiedKey;
}
function dispatch(backward, replace) {
var urlStr = getUrlForRouter();
var uri = url.parse(urlStr, true);
var query = uri.query;
uri.search = '';
uri.query = {};
// normalize to '/'
var path = url.stringify(uri) || '/';
var request = new Request({
query: query,
// backward or forward
backward: backward === true,
// replace history
replace: replace === true,
forward: (backward === false && replace === false),
path: path,
url: urlStr,
originalUrl: urlStr
});
var response = {
redirect: exports.navigate
};
exports.fire('dispatch', {
request: request,
}
if (!iframeDesc) {
iframeDesc = iframeMap[hostname] = {};
iframe = iframeDesc.iframe = doc.createElement('iframe');
Dom.css(iframe, {
position: 'absolute',
left: '-9999px',
top: '-9999px'
});
Dom.prepend(iframe, doc.body || doc.documentElement);
iframeUri = {};
iframeUri.protocol = uri.protocol;
iframeUri.host = uri.host;
iframeUri.pathname = proxy;
iframe.src = url.stringify(iframeUri);
} else {
iframe = iframeDesc.iframe;
}
Event.on(iframe, 'load', _onLoad, self);
}
});
}
if (!iframeDesc) {
iframeDesc = iframeMap[hostname] = {};
iframe = iframeDesc.iframe = doc.createElement('iframe');
Dom.css(iframe, {
position: 'absolute',
left: '-9999px',
top: '-9999px'
});
Dom.prepend(iframe, doc.body || doc.documentElement);
iframeUri = {};
iframeUri.protocol = uri.protocol;
iframeUri.host = uri.host;
iframeUri.pathname = proxy;
iframe.src = url.stringify(iframeUri);
} else {
iframe = iframeDesc.iframe;
}
DomEvent.on(iframe, 'load', _onLoad, self);
}
});