Skip to content

Commit

Permalink
feat(arcgis-rest-request): add support for AbortSignal
Browse files Browse the repository at this point in the history
IRequestOptions.signal is passed to fetch()
  • Loading branch information
tomwayson committed Mar 29, 2022
1 parent 446b8f0 commit 1462f1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/arcgis-rest-request/src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export function internalRequest(

const fetchOptions: RequestInit = {
method: httpMethod,
signal: options.signal,
/* ensures behavior mimics XMLHttpRequest.
needed to support sending IWA cookies */
credentials: options.credentials || "same-origin"
Expand Down
5 changes: 5 additions & 0 deletions packages/arcgis-rest-request/src/utils/IRequestOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export interface IRequestOptions {
headers?: {
[key: string]: any;
};
/**
* An [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) object instance; allows you to abort a request and via an [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
*/
signal?: AbortSignal;

/**
* Suppress any ArcGIS REST JS related warnings for this request.
*/
Expand Down

0 comments on commit 1462f1f

Please sign in to comment.