Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responses to Multiple requests in a changeset #25

Closed
dbonabalaya opened this issue Nov 17, 2021 · 2 comments
Closed

Responses to Multiple requests in a changeset #25

dbonabalaya opened this issue Nov 17, 2021 · 2 comments

Comments

@dbonabalaya
Copy link

When I send a request like:

--batch

--changeset

POST ...

--changeset

POST ...

--changeset--

--batch--

The response that comes back from (await odata.SendAsync(batch, stoppingToken)) only includes a single response (The batch response). I need to see the responses to my individual requests (POST) here.

Any advice @iwate ?

@maltadavi
Copy link

maltadavi commented Nov 25, 2021

By sending the request using odata.BatchAsync(batch, stoppingToken) we were able to get a return with 201 status when successful and the body response for each of the changeset items in the batch.

Attached is the extract from the test run.

Batch_with_response.txt

 var batch = new BatchRequest($"{endpoint}/$batch")
  {
      Requests = requests.Select(r => r.Item2).ToList()
  };

  var responses = await odata.BatchAsync(batch, stoppingToken);

  for (var i = 0; i < requests.Count; i++)
  {
      var response = responses[i];
      var request = requests[i];
      await _externalApiLogService.ProcessResponse(request.Item1, response);
  }

@iwate
Copy link
Owner

iwate commented Dec 3, 2021

@maltadavi thank you nice advice comment.

@dbonabalaya This lib has tow SendAsync method, one return single result and the other return multiple result.
You can get multiple result when pass IBatchRequest.

public Task<IReadOnlyList<Response>> SendAsync(IBatchRequest batchRequest, CancellationToken cancellationToken = default, bool? notfoundIsSuccess = null)

If you get single result element in multiple result when use IBatchRequest, Your OData server respond single response. Fiddler help you.

@iwate iwate closed this as completed Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants