Skip to content

Commit ade4d7c

Browse files
GoMinoAliAbdelfattahAli Abdelfattah
authored
[MOB-8872] Accept JSON responses in XhrInterceptor (#710)
* fix(network-interceptor): allow response body logging in dashboard * Update CHANGELOG.md Co-authored-by: Ali Abdelfattah <[email protected]> Co-authored-by: Ali Abdelfattah <[email protected]>
1 parent 4bebd22 commit ade4d7c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## master
2+
3+
* Fixes an issue with network responses of type JSON not getting logged
4+
15
## 11.0.0 (2022-06-07)
26

37
* Bumps Instabug native SDKs to v11

utils/XhrNetworkInterceptor.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,8 @@ const XHRInterceptor = {
127127
if (this.responseType === 'blob') {
128128
var responseText = await new Response(this.response).text();
129129
cloneNetwork.responseBody = responseText;
130-
} else if (
131-
this.responseType === 'text' ||
132-
this.responseType === ''
133-
) {
134-
cloneNetwork.responseBody = this.response;
130+
} else if (['text', '', 'json'].includes(this.responseType)) {
131+
cloneNetwork.responseBody = JSON.stringify(this.response);
135132
}
136133
}
137134

0 commit comments

Comments
 (0)