| 
				
			 | 
			
			
				@@ -146,6 +146,42 @@ describe('Upload multipart data with file from storage', (report, done) => { 
			 | 
		
	
		
			
			| 
				146
			 | 
			
				146
			 | 
			
			
				     }) 
			 | 
		
	
		
			
			| 
				147
			 | 
			
				147
			 | 
			
			
				 }) 
			 | 
		
	
		
			
			| 
				148
			 | 
			
				148
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				149
			 | 
			
			
				+describe('Upload and download at the same time', (report, done) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				151
			 | 
			
			
				+  let content = 'POST and PUT calls with headers and body should also work correctly' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				152
			 | 
			
			
				+  let filename = 'download-header-test-' + Date.now() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				153
			 | 
			
			
				+  let body = RNFetchBlob.base64.encode(content) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				154
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				155
			 | 
			
			
				+  RNFetchBlob 
			 | 
		
	
		
			
			| 
				
			 | 
			
				156
			 | 
			
			
				+    .config({ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				157
			 | 
			
			
				+      fileCache : true, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				158
			 | 
			
			
				+    }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				159
			 | 
			
			
				+    .fetch('POST', 'https://content.dropboxapi.com/2/files/upload', { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				160
			 | 
			
			
				+      Authorization : `Bearer ${DROPBOX_TOKEN}`, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				161
			 | 
			
			
				+      'Dropbox-API-Arg': '{\"path\": \"/rn-upload/'+filename+'\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				162
			 | 
			
			
				+      'Content-Type' : 'application/octet-stream', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				163
			 | 
			
			
				+    }, body) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				164
			 | 
			
			
				+    .then((resp) =>  { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				165
			 | 
			
			
				+      return RNFetchBlob.fs.readStream(resp.path(), 'utf8') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				166
			 | 
			
			
				+    }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				167
			 | 
			
			
				+    .then((stream) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				168
			 | 
			
			
				+      let actual = '' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				169
			 | 
			
			
				+      stream.open() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				170
			 | 
			
			
				+      stream.onData((chunk) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				171
			 | 
			
			
				+        actual += chunk 
			 | 
		
	
		
			
			| 
				
			 | 
			
				172
			 | 
			
			
				+      }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				173
			 | 
			
			
				+      stream.onEnd(() => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				174
			 | 
			
			
				+        report( 
			 | 
		
	
		
			
			| 
				
			 | 
			
				175
			 | 
			
			
				+          <Assert 
			 | 
		
	
		
			
			| 
				
			 | 
			
				176
			 | 
			
			
				+            key="response data should be the filename" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				177
			 | 
			
			
				+            expect={filename} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				178
			 | 
			
			
				+            actual={JSON.parse(actual).name} />) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				179
			 | 
			
			
				+        done() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				180
			 | 
			
			
				+      }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				181
			 | 
			
			
				+    }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				182
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				183
			 | 
			
			
				+}) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				184
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				149
			 | 
			
				185
			 | 
			
			
				 describe('Session create mechanism test', (report, done) => { 
			 | 
		
	
		
			
			| 
				150
			 | 
			
				186
			 | 
			
			
				   let sessionName = 'foo-' + Date.now() 
			 | 
		
	
		
			
			| 
				151
			 | 
			
				187
			 | 
			
			
				   testSessionName = sessionName 
			 |