|
@@ -13,7 +13,7 @@ import {
|
13
|
13
|
} from 'react-native';
|
14
|
14
|
|
15
|
15
|
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest
|
16
|
|
-window.Blob = Blob
|
|
16
|
+window.Blob = RNFetchBlob.polyfill.Blob
|
17
|
17
|
window.fetch = new RNFetchBlob.polyfill.Fetch({
|
18
|
18
|
auto : true,
|
19
|
19
|
binaryContentTypes : ['image/', 'video/', 'audio/']
|
|
@@ -46,3 +46,26 @@ describe('whatwg-fetch - GET should work correctly', (report, done) => {
|
46
|
46
|
done()
|
47
|
47
|
})
|
48
|
48
|
})
|
|
49
|
+
|
|
50
|
+RNTest.config({
|
|
51
|
+ group : '0.8.2',
|
|
52
|
+ run : true,
|
|
53
|
+ expand : false,
|
|
54
|
+ timeout : 24000
|
|
55
|
+})('request should not retry after timed out', (report, done) => {
|
|
56
|
+
|
|
57
|
+ let count = 0
|
|
58
|
+ RNFetchBlob
|
|
59
|
+ .config({ timeout : 3000 })
|
|
60
|
+ .fetch('GET', `${TEST_SERVER_URL}/timeout`)
|
|
61
|
+ .then((res) => {
|
|
62
|
+ report(<Assert key="request should not success" expect={true} actual={false}/>)
|
|
63
|
+ })
|
|
64
|
+ .catch(() => {
|
|
65
|
+ count ++
|
|
66
|
+ })
|
|
67
|
+ setTimeout(() => {
|
|
68
|
+ report(<Assert key="request does not retry" expect={1} actual={count}/>)
|
|
69
|
+ done()
|
|
70
|
+ }, 12000)
|
|
71
|
+})
|