UNPKG

@esri/arcgis-rest-request

Version:

Common methods and utilities for @esri/arcgis-rest-js packages.

22 lines 659 B
/** * Is the given URL the same origin as the current window? * Used to determine if we need to do any additional cross-origin * handling for the request. * @param url * @param win - optional window object to use for origin comparison * (useful for testing) * @returns */ export function isSameOrigin(url, win) { var _a; /* istanbul ignore next */ if ((!win && !window) || !url) { return false; } else { win = win || window; const origin = (_a = win.location) === null || _a === void 0 ? void 0 : _a.origin; return url.startsWith(origin); } } //# sourceMappingURL=isSameOrigin.js.map