Open greynoO opened 2 days ago
Info: It works when building the batched request manually with HttpClient.
var batchRequests = new List<object>();
var url = $"/drives/{item.DriveId}/items/{item.DriveItemId}/content";
var requestId = Guid.NewGuid().ToString();
batchRequests.Add(new
{
id = requestId,
method = "GET",
url = url
});
var batchRequestBody = new
{
requests = batchRequests
};
var batchResponse = await _httpClient.PostAsync(
"$batch",
new StringContent(
System.Text.Json.JsonSerializer.Serialize(batchRequestBody),
Encoding.UTF8,
"application/json"
)
);
So there might be something wrong with BatchRequestContent
?
The /content call returns a 302 status with a Location
header to the actual file.
{"responses": [{"id":"<someId>","status":302,"headers":{"Location":"<uri>","Cache-Control":"no-store, no-cache","Content-Type":"application/octet-stream"},"body":""}]}
I guess that only the empty body is evaluated?
Describe the bug
When using
BatchRequestContentCollection
(orBatchRequestContent
) to request a stream content it only returns an empty stream (Length = 0). This happens regardless of whether there is a single or multiple requests in the collection.I also tried to just use
GetResponseByIdAsync
, Header information saysThis does not occur when doing a single request without batching:
The stream gets returned correctly then.
Expected behavior
Batched requests should return stream content correctly.
How to reproduce
SDK Version
3.2.1
Latest version known to work for scenario above?
don't know
Configuration