Skip to content

Commit

Permalink
[Core-client] Update the stream check in serializer (Azure#13923)
Browse files Browse the repository at this point in the history
We've moved from `() => NodeJS.ReadableStream` to
`NodeJS.ReadableStream` in `RequestBodyType`. This change updates the
condition for this case.
  • Loading branch information
jeremymeng authored Feb 23, 2021
1 parent eafa579 commit 0db4909
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdk/core/core-client/src/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,13 @@ function serializeBasicTypes(typeName: string, objectName: string, value: any):
const objectType = typeof value;
if (
objectType !== "string" &&
objectType !== "function" &&
typeof value.pipe !== "function" &&
!(value instanceof ArrayBuffer) &&
!ArrayBuffer.isView(value) &&
!(value?.constructor?.name === "Blob")
) {
throw new Error(
`${objectName} must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream.`
`${objectName} must be a string, Blob, ArrayBuffer, ArrayBufferView, or NodeJS.ReadableStream.`
);
}
}
Expand Down

0 comments on commit 0db4909

Please sign in to comment.