fix: add FetchProxy

This will let us intercept fetch requests (until now we're only proxying
XMLHttpRequest), in order to fix the issues we're experiencing with some
features.

Bug: twpowertools:229
Change-Id: I277473c05479ca39bb6183a51855382124890bde
diff --git a/src/xhrInterceptor/fetchProxy/FetchBody.ts b/src/xhrInterceptor/fetchProxy/FetchBody.ts
new file mode 100644
index 0000000..a178009
--- /dev/null
+++ b/src/xhrInterceptor/fetchProxy/FetchBody.ts
@@ -0,0 +1,12 @@
+export default class FetchBody {
+  constructor(private body: RequestInit['body'] | undefined) {}
+
+  async getJSONRequestBody() {
+    if (!this.body) return undefined;
+
+    // Using Response is a hack, but it works and converts a possibly long code
+    // into a one-liner :D
+    // Source of inspiration: https://stackoverflow.com/a/72718732
+    return await new Response(this.body).json();
+  }
+}