Skip to content

Cannot add $select query to item within batch request content  #822

@henhal

Description

@henhal

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

When using batch requests, each BatchRequestStep contains a plain Request object.
However, if some of the steps should include query parameters such as $select, something strange is happening: if a step has a request like users/foo@bar.com?$select=mail,accountEnabled, then $select will disappear, and the request will become users/foo@bar.com?=mail,accountEnabled, which means the desired selected fields won't be there.

Console Errors: N/A

Screenshots: N/A

Steps to Reproduce

const content = await new BatchRequestContent([{
    id: 'foo',
    request: new Request('/users/foo@bar.com?$select=mail,accountEnabled')
}]).getContent();

const res = await client.api('/$batch').post(content);

for (const [id, response] of await new BatchResponseContent(await res.json()).getResponsesIterator()) {
  if (response.ok) {
    console.log('Batch item', id, await response.json());
  } else {
    console.error('Batch error', id, response.status);
  }
}

Expected behavior:

It should be possible to add $select queries to items within batch requests.

Actual behavior:

The $select query was malformed and ignored.

Additional Context

Usage Information

Request ID - Value of the requestId field if you are receiving a Graph API error response

SDK Version - [SDK version you are using]

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

Node Version - 14

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

Browser Name - [The name of Browser that you are using for SDK]

Version - [The version of the browser you are using]

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