XHR interceptor: add request ID to event details
Sometimes an interceptor exists for both the request and response bodies
of a request, and we need to pair request with response. In order to
allow this, this change adds a request ID in the event details so the
two events can be linked together.
Change-Id: I1360a38dc6362925ccc8609f77ee3d871874902a
diff --git a/src/common/xhrInterceptorUtils.js b/src/common/xhrInterceptorUtils.js
index baa2bd3..867c323 100644
--- a/src/common/xhrInterceptorUtils.js
+++ b/src/common/xhrInterceptorUtils.js
@@ -31,10 +31,11 @@
return undefined;
}
-export function triggerEvent(eventName, body) {
+export function triggerEvent(eventName, body, id) {
var evt = new CustomEvent('TWPT_' + eventName, {
detail: {
body,
+ id,
}
});
window.dispatchEvent(evt);