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/interceptors/interceptors.ts b/src/xhrInterceptor/interceptors/interceptors.ts
new file mode 100644
index 0000000..1454aad
--- /dev/null
+++ b/src/xhrInterceptor/interceptors/interceptors.ts
@@ -0,0 +1,38 @@
+import { Interceptor } from './InterceptorHandler.port';
+
+const interceptors: { interceptors: Interceptor[] } = {
+ interceptors: [
+ {
+ eventName: 'ViewForumRequest',
+ urlRegex: /api\/ViewForum/,
+ intercepts: 'request',
+ },
+ {
+ eventName: 'ViewForumResponse',
+ urlRegex: /api\/ViewForum/,
+ intercepts: 'response',
+ },
+ {
+ eventName: 'CreateMessageRequest',
+ urlRegex: /api\/CreateMessage/,
+ intercepts: 'request',
+ },
+ {
+ eventName: 'ViewUnifiedUserResponse',
+ urlRegex: /api\/ViewUnifiedUser/,
+ intercepts: 'response',
+ },
+ {
+ eventName: 'ListCannedResponsesResponse',
+ urlRegex: /api\/ListCannedResponses/,
+ intercepts: 'response',
+ },
+ {
+ eventName: 'ViewThreadResponse',
+ urlRegex: /api\/ViewThread/,
+ intercepts: 'response',
+ },
+ ],
+};
+
+export default interceptors;