Skip to content

Commit

Permalink
Merge pull request #661 from Esri/b/get-item-resources-mutates-reques…
Browse files Browse the repository at this point in the history
…t-options

fix(getItemResources): do not mutate requestOptions in getItemResources
  • Loading branch information
dbouwman authored Feb 24, 2020
2 parents 25778e3 + 97cbec0 commit 47841cd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/arcgis-rest-portal/src/items/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,16 @@ export function getItemResources(
): Promise<any> {
const url = `${getPortalUrl(requestOptions)}/content/items/${id}/resources`;

// mix in user supplied params
requestOptions.params = {
...requestOptions.params,
num: 1000
// Mix in num:1000 with any user supplied params
// Key thing - we don't want to mutate the passed in requestOptions
// as that may be used in other (subsequent) calls in the course
// of a long promise chains
const options: IRequestOptions = {
...requestOptions
};
options.params = { num: 1000, ...options.params };

return request(url, requestOptions);
return request(url, options);
}

export interface IGetItemGroupsResponse {
Expand Down

0 comments on commit 47841cd

Please sign in to comment.