react-native-in-app-debugger 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.jsx +2 -2
- package/package.json +1 -1
- package/useApiInterceptor.js +10 -34
package/index.jsx
CHANGED
|
@@ -29,7 +29,7 @@ import useApiInterceptor from "./useApiInterceptor";
|
|
|
29
29
|
|
|
30
30
|
const dimension = Dimensions.get("window");
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const v = DeviceInfo?.getReadableVersion() || "";
|
|
33
33
|
|
|
34
34
|
const Label = (props) => (
|
|
35
35
|
<Text
|
|
@@ -40,7 +40,7 @@ const Label = (props) => (
|
|
|
40
40
|
/>
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
export default ({ variables, env }) => {
|
|
43
|
+
export default ({ variables, env, version = v }) => {
|
|
44
44
|
const { apis, clear } = useApiInterceptor();
|
|
45
45
|
|
|
46
46
|
const [tab, setTab] = useState("api");
|
package/package.json
CHANGED
package/useApiInterceptor.js
CHANGED
|
@@ -73,6 +73,7 @@ export default () => {
|
|
|
73
73
|
XHRInterceptor.enableInterception();
|
|
74
74
|
// console.log('API interceptor status', XHRInterceptor.isInterceptorEnabled());
|
|
75
75
|
XHRInterceptor.setSendCallback((...obj) => {
|
|
76
|
+
obj[1].responseType = "text";
|
|
76
77
|
const data = parse(obj[0]);
|
|
77
78
|
|
|
78
79
|
const { _method: method, _url: url, _headers: headers } = obj[1];
|
|
@@ -89,45 +90,20 @@ export default () => {
|
|
|
89
90
|
});
|
|
90
91
|
|
|
91
92
|
XHRInterceptor.setResponseCallback((...obj) => {
|
|
92
|
-
const
|
|
93
|
-
const { _method: method, _url: url, _response, status } = xhr;
|
|
93
|
+
const { _method: method, _url: url, _response, status } = obj[5];
|
|
94
94
|
if (filterNonBusinessRelatedAPI) {
|
|
95
95
|
if (shouldExclude(url, method)) return;
|
|
96
96
|
}
|
|
97
97
|
const data = parse(_response);
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
config: {
|
|
108
|
-
url,
|
|
109
|
-
method,
|
|
110
|
-
},
|
|
111
|
-
data: response,
|
|
112
|
-
status,
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
} catch (e) {
|
|
116
|
-
console.log(e);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (Platform.OS === "android" || !data.blobId) {
|
|
122
|
-
receiveResponse({
|
|
123
|
-
config: {
|
|
124
|
-
url,
|
|
125
|
-
method,
|
|
126
|
-
},
|
|
127
|
-
data,
|
|
128
|
-
status,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
99
|
+
receiveResponse({
|
|
100
|
+
config: {
|
|
101
|
+
url,
|
|
102
|
+
method,
|
|
103
|
+
},
|
|
104
|
+
data,
|
|
105
|
+
status,
|
|
106
|
+
});
|
|
131
107
|
});
|
|
132
108
|
}, []);
|
|
133
109
|
|