@@ -5,59 +5,13 @@ import {
5
5
Platform
6
6
} from 'react-native' ;
7
7
let { Instabug } = NativeModules ;
8
- import interceptor from './utils/NetworkInterceptor.js' ;
9
8
import InstabugUtils from './utils/InstabugUtils.js' ;
10
9
import BugReporting from './modules/BugReporting.js' ;
11
10
import Surveys from './modules/Surveys.js' ;
12
11
import FeatureRequests from './modules/FeatureRequests.js' ;
13
12
14
13
InstabugUtils . captureJsErrors ( ) ;
15
14
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
-
61
15
/**
62
16
* Instabug
63
17
* @exports Instabug
0 commit comments