Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion spec/core/GraphRequestUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,15 @@ describe("GraphRequestUtil.ts", () => {
node2.link = node1;
try {
serializeContent(node1);
throw new Error("Something wrong with the serialize content, it should stringify cyclic referenced objects");
throw new Error("Something wrong with the serialize content, it should not stringify cyclic referenced objects");
} catch (error) {
assert.equal(error.message, "Unable to stringify the content");
}
});

it("Should return undefined for the case of undefined content value", () => {
const val = undefined;
assert.equal(serializeContent(val), undefined);
});
});
});
2 changes: 1 addition & 1 deletion src/GraphRequestUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const urlJoin = (urlSegments: string[]): string => {
*/

export const serializeContent = (content: any): any => {
const className: string = content.constructor.name;
const className: string = content === undefined ? undefined : content.constructor.name;
if (className === "Buffer" || className === "Blob" || className === "File" || className === "FormData" || typeof content === "string") {
return content;
}
Expand Down