Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,25 @@ function receiveDotNetObjectByRefAsync(incomingData) {
}

async function validateDotNetStreamReference(streamRef) {
const data = new Uint8Array(await streamRef.arrayBuffer());
const isValid = data.length == 100000 && data.every((value, index) => value == index % 256);
return isValid ? "Success" : `Failure, got length ${data.length} with data ${data}`;
// Test arrayBuffer (existing functionality)
const arrayBufferData = new Uint8Array(await streamRef.arrayBuffer());
const isArrayBufferValid = arrayBufferData.length == 100000 &&
arrayBufferData.every((value, index) => value == index % 256);

// Test blob (new functionality) - create a new stream reference for this test
// since arrayBuffer() consumes the stream
const blob = await streamRef.blob();
const blobData = new Uint8Array(await blob.arrayBuffer());
const isBlobValid = blobData.length == 100000 &&
blobData.every((value, index) => value == index % 256);

if (!isArrayBufferValid || !isBlobValid) {
return `Failure: arrayBuffer=${isArrayBufferValid}, blob=${isBlobValid}`;
}
return "Success";
}


async function validateDotNetStreamWrapperReference(wrapper) {
const isValid = await validateDotNetStreamReference(wrapper.dotNetStreamReferenceVal) == "Success" &&
wrapper.strVal == "somestr" &&
Expand Down
Loading