From 4619f2566435a5f0c2ff15793c2822ba8b82c95c Mon Sep 17 00:00:00 2001 From: Abhinav Srivastava Date: Fri, 9 Aug 2019 14:40:55 +0530 Subject: [PATCH] Made changes so that batching works for json response --- src/content/BatchResponseContent.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/content/BatchResponseContent.ts b/src/content/BatchResponseContent.ts index 3c4d04f56..bc0f50873 100644 --- a/src/content/BatchResponseContent.ts +++ b/src/content/BatchResponseContent.ts @@ -69,6 +69,12 @@ export class BatchResponseContent { options.statusText = responseJSON.statusText; } options.headers = responseJSON.headers; + if (options.headers !== undefined && options.headers["Content-Type"] !== undefined) { + if (options.headers["Content-Type"].split(";")[0] === "application/json") { + const bodyString = JSON.stringify(body); + return new Response(bodyString, options); + } + } return new Response(body, options); }