Skip to content

Commit

Permalink
fix(:bug:): dont set referer to null in browser apps
Browse files Browse the repository at this point in the history
AFFECTS PACKAGES:
@esri/arcgis-rest-request
  • Loading branch information
jgravois committed Jan 23, 2019
1 parent 4621146 commit 0b1bf2b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/arcgis-rest-request/src/request.ts
Expand Up @@ -186,13 +186,15 @@ export function request(
}

// Mixin headers from request options
/* istanbul ignore next - karma reports coverage on browser tests only */
fetchOptions.headers = {
referer:
typeof window === "undefined" ? NODEJS_DEFAULT_REFERER_HEADER : null,
...requestOptions.headers
};

/* istanbul ignore next - karma reports coverage on browser tests only */
if (typeof window === "undefined" && !fetchOptions.headers.referer) {
fetchOptions.headers.referer = NODEJS_DEFAULT_REFERER_HEADER;
}

/* istanbul ignore else blob responses are difficult to make cross platform we will just have to trust the isomorphic fetch will do its job */
if (!requiresFormData(params)) {
fetchOptions.headers["Content-Type"] =
Expand Down

0 comments on commit 0b1bf2b

Please sign in to comment.