From 59dbc3e0a3257e74a92d05c03897dd568b3f01ce Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Wed, 9 Dec 2020 00:04:31 -0800 Subject: [PATCH] Switch from USVString to Blob for body content. --- extension/src/bg/background.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extension/src/bg/background.js b/extension/src/bg/background.js index 4c4cbef..296554e 100755 --- a/extension/src/bg/background.js +++ b/extension/src/bg/background.js @@ -207,7 +207,10 @@ async function perform_http_request(params) { // If there is a request body, we decode it // and set it for the request. if (params.body) { - request_options.body = atob(params.body); + // This is a hack to convert base64 to a Blob + const fetchURL = `data:application/octet-stream;base64,${params.body}`; + const fetchResp = await fetch(fetchURL); + request_options.body = await fetchResp.blob(); } try {