@@ -5,59 +5,13 @@ import {
55 Platform
66} from 'react-native' ;
77let { Instabug } = NativeModules ;
8- import interceptor from './utils/NetworkInterceptor.js' ;
98import InstabugUtils from './utils/InstabugUtils.js' ;
109import BugReporting from './modules/BugReporting.js' ;
1110import Surveys from './modules/Surveys.js' ;
1211import FeatureRequests from './modules/FeatureRequests.js' ;
1312
1413InstabugUtils . captureJsErrors ( ) ;
1514
16- var jsonObject = {
17- url : '' ,
18- requestBody : '' ,
19- responseBody : '' ,
20- method : '' ,
21- responseCode : undefined ,
22- headers : ''
23- }
24-
25- // Register the interceptor for fetch requests
26- interceptor . register ( {
27- request : function ( url , config ) {
28- // Modify the url or config here
29- jsonObject . url = url ;
30- if ( ! config || ! config . method ) {
31- jsonObject . method = 'GET' ;
32- }
33- if ( config ) {
34- if ( config . body ) {
35- jsonObject . requestBody = config . body ;
36- } else {
37- jsonObject . requestBody = '' ;
38- }
39- if ( config . method ) {
40- jsonObject . method = config . method ;
41- }
42- if ( config . headers ) {
43- jsonObject . headers = config . headers ;
44- } else {
45- jsonObject . headers = '' ;
46- }
47- }
48- return [ url , config ] ;
49- } ,
50- response : function ( response ) {
51- // Modify the reponse object;
52- jsonObject . responseCode = response . status ;
53- jsonObject . responseBody = response . _bodyText ? response . _bodyText : '' ;
54- if ( Platform . OS === 'android' ) {
55- Instabug . networkLog ( JSON . stringify ( jsonObject ) ) ;
56- }
57- return response ;
58- }
59- } ) ;
60-
6115/**
6216 * Instabug
6317 * @exports Instabug
0 commit comments