Skip to content

PageIterator should not mutate his arguments #959

@OlivierCuyp

Description

@OlivierCuyp

Bug Report

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?

For more information, see the CONTRIBUTING guide.

Description

Impure function has always unexpected behaviour.
PageIterator his mutating the response he is given, he should not.
Here is the mutation:
https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/src/tasks/PageIterator.ts#L127

Expected behavior:
The response passed to the PageIterator should be intact after iteration.
Change the Array.shift method to use Array.slice and keep a cursor index.

Actual behavior:
The response passed to the PageIterator is empty after the iteration.

SDK Version - 3.0.2

  • Node (Check, if using Node version of SDK)

Node Version - 16.17.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions