|  | @@ -112,7 +112,7 @@ describe('GET request test : path -> any', (report, done) => {
 | 
	
		
			
			| 112 | 112 |  
 | 
	
		
			
			| 113 | 113 |  })
 | 
	
		
			
			| 114 | 114 |  
 | 
	
		
			
			| 115 |  | -describe('POST base64 body auto strategy', (report, done) => {
 | 
	
		
			
			|  | 115 | +describe('POST different types of body', (report, done) => {
 | 
	
		
			
			| 116 | 116 |  
 | 
	
		
			
			| 117 | 117 |    let image = RNTest.prop('image')
 | 
	
		
			
			| 118 | 118 |    let tmpPath = dirs.DocumentDir + '/tmp-' + Date.now()
 | 
	
	
		
			
			|  | @@ -121,14 +121,12 @@ describe('POST base64 body auto strategy', (report, done) => {
 | 
	
		
			
			| 121 | 121 |      let name = `fetch-replacement-${Platform.OS}-${Date.now()}.png`
 | 
	
		
			
			| 122 | 122 |      return pBody.then((body) =>
 | 
	
		
			
			| 123 | 123 |        fetch('https://content.dropboxapi.com/2/files/upload', {
 | 
	
		
			
			| 124 |  | -        method : method,
 | 
	
		
			
			|  | 124 | +        method : 'post',
 | 
	
		
			
			| 125 | 125 |          headers : {
 | 
	
		
			
			| 126 | 126 |            Authorization : `Bearer ${DROPBOX_TOKEN}`,
 | 
	
		
			
			| 127 | 127 |            'Dropbox-API-Arg': '{\"path\": \"/rn-upload/'+name+'\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}',
 | 
	
		
			
			| 128 | 128 |            'Content-Type' : 'application/octet-stream'
 | 
	
		
			
			| 129 |  | -        },
 | 
	
		
			
			| 130 |  | -        body : body
 | 
	
		
			
			| 131 |  | -      })
 | 
	
		
			
			|  | 129 | +        }, body })
 | 
	
		
			
			| 132 | 130 |      )
 | 
	
		
			
			| 133 | 131 |      .then((res) => {
 | 
	
		
			
			| 134 | 132 |        return res.json()
 | 
	
	
		
			
			|  | @@ -139,12 +137,42 @@ describe('POST base64 body auto strategy', (report, done) => {
 | 
	
		
			
			| 139 | 137 |    }
 | 
	
		
			
			| 140 | 138 |  
 | 
	
		
			
			| 141 | 139 |    let tests = [
 | 
	
		
			
			| 142 |  | -    upload('upload base64 encoded body', 'post', Promise.resolve(image)),
 | 
	
		
			
			| 143 |  | -    upload('upload Blob body', 'post', Blob.build(image, 'image/png;BASE64')),
 | 
	
		
			
			| 144 |  | -    upload('upload file path body', 'post', fs.writeFile(tmpPath, image, 'base64').then(() => Promise.resolve(RNFetchBlob.wrap(tmpPath))))
 | 
	
		
			
			|  | 140 | +    upload('upload base64 encoded body', Promise.resolve(image)),
 | 
	
		
			
			|  | 141 | +    upload('upload Blob body', Blob.build(image, 'image/png;BASE64')),
 | 
	
		
			
			|  | 142 | +    upload('upload file path body', fs.writeFile(tmpPath, image, 'base64').then(() => Promise.resolve(RNFetchBlob.wrap(tmpPath))))
 | 
	
		
			
			| 145 | 143 |    ]
 | 
	
		
			
			| 146 | 144 |  
 | 
	
		
			
			| 147 | 145 |    Promise.all(tests).then(() => done())
 | 
	
		
			
			| 148 | 146 |  
 | 
	
		
			
			|  | 147 | +})
 | 
	
		
			
			|  | 148 | +
 | 
	
		
			
			|  | 149 | +describe('check HTTP body correctness', (report, done) => {
 | 
	
		
			
			|  | 150 | +
 | 
	
		
			
			|  | 151 | +  let tmpPath = dirs.DocumentDir + '/tmp-' + Date.now()
 | 
	
		
			
			|  | 152 | +
 | 
	
		
			
			|  | 153 | +  function upload(pBody) {
 | 
	
		
			
			|  | 154 | +    return pBody.then((body) =>
 | 
	
		
			
			|  | 155 | +      fetch('https://content.dropboxapi.com/2/files/upload', {
 | 
	
		
			
			|  | 156 | +        method : 'POST',
 | 
	
		
			
			|  | 157 | +        headers : {
 | 
	
		
			
			|  | 158 | +          Authorization : `Bearer ${DROPBOX_TOKEN}`,
 | 
	
		
			
			|  | 159 | +          'Dropbox-API-Arg': '{\"path\": \"/rn-upload/'+name+'\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}',
 | 
	
		
			
			|  | 160 | +          'Content-Type' : 'application/octet-stream'
 | 
	
		
			
			|  | 161 | +        }, body })
 | 
	
		
			
			|  | 162 | +      .then((res) => res.json())
 | 
	
		
			
			|  | 163 | +      .then((info) => {
 | 
	
		
			
			|  | 164 | +        
 | 
	
		
			
			|  | 165 | +      })
 | 
	
		
			
			|  | 166 | +    )
 | 
	
		
			
			|  | 167 | +  }
 | 
	
		
			
			|  | 168 | +
 | 
	
		
			
			|  | 169 | +
 | 
	
		
			
			|  | 170 | +  let pUnicodeBody = fetch(`${TEST_SERVER_URL}/public/utf8-dummy`, { method : 'GET' })
 | 
	
		
			
			|  | 171 | +    .then((res) => res.text())
 | 
	
		
			
			|  | 172 | +
 | 
	
		
			
			|  | 173 | +  let tests = [
 | 
	
		
			
			|  | 174 | +    upload(pUnicodeBody)
 | 
	
		
			
			|  | 175 | +  ]
 | 
	
		
			
			|  | 176 | +
 | 
	
		
			
			| 149 | 177 |  
 | 
	
		
			
			| 150 | 178 |  })
 |