Skip to content

Commit

Permalink
Merge branch 'dev' into build_middleware_chain
Browse files Browse the repository at this point in the history
  • Loading branch information
krototype authored Oct 15, 2019
2 parents 834fcf3 + 7baaf98 commit b2f7d3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit b2f7d3b

Please sign in to comment.