From 2fc49a98eb3ebd0f132a0a39bff59a4e70ebfd3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Wenzel?= Date: Sat, 14 Oct 2017 22:10:18 +0200 Subject: [PATCH] feat(HttpClient): add JSON.stringify replacer Adds optional parameter for replacer to be used when stringifying json. --- src/util.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util.js b/src/util.js index 12ce9ae..d403306 100644 --- a/src/util.js +++ b/src/util.js @@ -3,8 +3,9 @@ * Useful for easily creating JSON fetch request bodies. * * @param body The object to be serialized to JSON. +* @param replacer The JSON.stringify replacer used when serializing. * @returns A Blob containing the JSON serialized body. */ -export function json(body: any): Blob { - return new Blob([JSON.stringify((body !== undefined ? body : {}))], { type: 'application/json' }); +export function json(body: any, replacer?: any): Blob { + return new Blob([JSON.stringify((body !== undefined ? body : {}), replacer)], { type: 'application/json' }); }