Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit d7f0af3

Browse files
authored
Update README.md
1 parent 4bac348 commit d7f0af3

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

README.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -148,30 +148,10 @@ var RNFetchBlob = require('react-native-fetch-blob').default
148148

149149
After `0.8.0` react-native-fetch-blob automatically decide how to send the body by checking `Content-Type` in header.
150150

151-
The rules are shown in the following sample
151+
The rules are shown in the following diagram
152152

153-
```js
154-
import RNFetchblob from 'react-native-fetch-blob'
155-
156-
// If body is an Array send as multipart form data
157-
RNFetchBlob.fetch('POST'),'http://upload.server.my' { /* whatever it is */ }, [{ name : 'field1', data : 'test' }])
158-
159-
// If body is a string starts with prefix 'RNFetchBlob-file://' send request with input stream from the patg
160-
RNFetchBlob.fetch('POST'),'http://upload.server.my' { /* whatever it is */ }, 'RNFetchBlob-file://' + path)
161-
RNFetchBlob.fetch('POST'),'http://upload.server.my' { /* whatever it is */ }, RNFetchBlob.wrap(path))
162-
163-
// If content-type contains `base64;` or `application/octet` the body will be decoded using BASE64 decoder
164-
RNFetchBlob.fetch('POST','http://upload.server.my', { 'Content-Type' : 'anything;base64' }, BASE64_BODY)
165-
RNFetchBlob.fetch('POST','http://upload.server.my', { 'Content-Type' : 'application/octet-binary' }, BASE64_BODY)
166-
167-
// Send the data as the string you given
168-
RNFetchBlob.fetch('POST', 'http://upload.server.my', { /*any content-type not matching above rules*/ 'Content-Type' : 'text/foo' }, data)
169-
RNFetchBlob.fetch('POST', 'http://upload.server.my', { 'text/plain' }, 'text in the body')
170-
RNFetchBlob.fetch('POST', 'http://upload.server.my', { 'application/json' }, JSON.stringify(some_data))
171-
172-
```
153+
<img src="img/RNFB-flow.png" style="width : 90% />
173154

174-
If no 'Content-Type' field in headers, it will use default content type `application/octet-stream` and convert given `body` to binary data using BASE64 decoder.
175155

176156
#### Download example : Fetch files that needs authorization token
177157

0 commit comments

Comments
 (0)