We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
BatchRequest.ResponseHttpStatusCode
I want to get a status code of an Delete Operation and lookup the ResponseHttpStatusCode in the request:
ResponseHttpStatusCode
var user = await context.Web.SiteUsers.FirstOrDefaultAsync(u => u.Id == principalId); Batch batch = context.NewBatch(); user.DeleteBatch(batch); await context.ExecuteAsync(batch); if (batch.Requests[0].ResponseHttpStatusCode == 0) { throw new InvalidOperationException("ResponseHttpStatusCode should be 200"); }
But the ResponseHttpStatusCode is always 0.
I took a look into the batch content and it is something like:
--batchresponse_b162bc00-56aa-475d-aef0-04e983426936 Content-Type: application/http Content-Transfer-Encoding: binary HTTP/1.1 200 OK CONTENT-TYPE: application/json;odata=nometadata;streaming=true;charset=utf-8 --batchresponse_b162bc00-56aa-475d-aef0-04e983426936--
I think I traced the origin to
pnpcore/src/sdk/PnP.Core/Services/Core/BatchClient.cs
Lines 1705 to 1714 in 0b6106c
With no line starts with a { the variabel responseContentOpen never gets set to true and because of
{
responseContentOpen
true
Line 1623 in 0b6106c
the lines
https://github.com/pnp/pnpcore/blob/0b6106c9e28c0a8ba23bae1dd471c90f81d22b05/src/sdk/PnP.Core/Services/Core/BatchClient.cs#L1657C1-L1664C30
not getting called for this request
The ResponseHttpStatusCode is set for all BatchRequests.
Thanks for your contribution! Sharing is caring.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Category
Describe the bug
I want to get a status code of an Delete Operation and lookup the
ResponseHttpStatusCode
in the request:But the
ResponseHttpStatusCode
is always 0.I took a look into the batch content and it is something like:
I think I traced the origin to
pnpcore/src/sdk/PnP.Core/Services/Core/BatchClient.cs
Lines 1705 to 1714 in 0b6106c
With no line starts with a
{
the variabelresponseContentOpen
never gets set totrue
and because ofpnpcore/src/sdk/PnP.Core/Services/Core/BatchClient.cs
Line 1623 in 0b6106c
the lines
https://github.com/pnp/pnpcore/blob/0b6106c9e28c0a8ba23bae1dd471c90f81d22b05/src/sdk/PnP.Core/Services/Core/BatchClient.cs#L1657C1-L1664C30
not getting called for this request
Steps to reproduce
Expected behavior
The
ResponseHttpStatusCode
is set for all BatchRequests.Environment details (development & target environment)
Additional context
Thanks for your contribution! Sharing is caring.
The text was updated successfully, but these errors were encountered: