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

support PATCH action in iOS #308

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Thank you for making a pull request ! Just a gentle reminder :)

1. If the PR is offering a feature please make the request to our "Feature Branch" 0.11.0
2. Bug fix request to "Bug Fix Branch" 0.10.3
2. Bug fix request to "Bug Fix Branch" 0.10.5
3. Correct README.md can directly to master
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[![release](https://img.shields.io/github/release/wkh237/react-native-fetch-blob.svg?style=flat-square)](https://github.com/wkh237/react-native-fetch-blob/releases) [![npm](https://img.shields.io/npm/v/react-native-fetch-blob.svg?style=flat-square)](https://www.npmjs.com/package/react-native-fetch-blob) ![](https://img.shields.io/badge/PR-Welcome-brightgreen.svg?style=flat-square) [![](https://img.shields.io/badge/Wiki-Public-brightgreen.svg?style=flat-square)](https://github.com/wkh237/react-native-fetch-blob/wiki) [![npm](https://img.shields.io/npm/l/react-native-fetch-blob.svg?maxAge=2592000&style=flat-square)]()


A project committed to making file access and data transfer easier, efficient for React Native developers.
> For Firebase Storage solution, please upgrade to latest version for best compatibility.
A project committed to making file access and data transfer easier and more efficient for React Native developers.
> For Firebase Storage solution, please upgrade to the latest version for the best compatibility.

## Features
- Transfer data directly from/to storage without BASE64 bridging
Expand All @@ -13,7 +13,7 @@ A project committed to making file access and data transfer easier, efficient fo
- Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
- JSON stream supported base on [Oboe.js](https://github.com/jimhigson/oboe.js/) @jimhigson

## TOC
## TOC (visit [Wiki](https://github.com/wkh237/react-native-fetch-blob/wiki) to get the complete documentation)
* [About](#user-content-about)
* [Installation](#user-content-installation)
* [HTTP Data Transfer](#user-content-http-data-transfer)
Expand All @@ -32,15 +32,15 @@ A project committed to making file access and data transfer easier, efficient fo
* [File stream](#user-content-file-stream)
* [Manage cached files](#user-content-cache-file-management)
* [Web API Polyfills](#user-content-web-api-polyfills)
* [Performance Tips](#user-content-performance-tips)
* [Performance Tips](#user-content-performance-tipsd)
* [API References](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API)
* [Caveats](#user-content-caveats)
* [Development](#user-content-development)

## About

This project was initially for solving the issue [facebook/react-native#854](https://github.com/facebook/react-native/issues/854) because React Native lack of `Blob` implementation and it's problematic when transferring binary data. Now the project is committed to making file access and transfer easier, efficient for React Native developers.
We've implemented highly customizable filesystem and network module which plays well together. For example, upload and download data directly from/to storage which is much more efficient in some cases(especially for large ones). The file system supports file stream, so you don't have to worry about OOM problem when accessing large files.
This project was initially created to solve the issue [facebook/react-native#854](https://github.com/facebook/react-native/issues/854) because React Native lacks any `Blob` implementation and is problematic when transferring binary data. The project is committed to making file access and transfer easier and more efficient for React Native developers.
We've implemented highly customizable filesystem and network module which plays well together. For example, developers can upload and download data directly from/to storage, which is more efficient, especially for large files. The file system supports file stream, so you don't have to worry about OOM problem when accessing large files.

In `0.8.0` we introduced experimental Web API polyfills that make it possible to use browser-based libraries in React Native, such as, [FireBase JS SDK](https://github.com/wkh237/rn-firebase-storage-upload-sample)

Expand All @@ -53,7 +53,7 @@ Install package from npm
npm install --save react-native-fetch-blob
```

Or if using CocoaPods, add the pod to your `Podfile`, for example:
Or if using CocoaPods, add the pod to your `Podfile`

```
pod 'react-native-fetch-blob',
Expand All @@ -68,7 +68,7 @@ npm install --save github:wkh237/react-native-fetch-blob-package#<branch_name>
```
**Automatically Link Native Modules**

For 0.29.2+ projects, simply link native packages via the following command because rnpm has been merged into react-native, you no longer need it.
For 0.29.2+ projects, simply link native packages via the following command (note: rnpm has been merged into react-native)

```
react-native link
Expand Down Expand Up @@ -115,7 +115,7 @@ If you're going to access external storage (say, SD card storage) for `Android 5

```

Also, if you're going to use `Android Download Manager` you have to add this to `AndroidManifetst.xml`
Also, if you're going to use `Android Download Manager` you have to add this to `AndroidManifest.xml`

```diff
<intent-filter>
Expand Down Expand Up @@ -152,7 +152,7 @@ var RNFetchBlob = require('react-native-fetch-blob').default

### Regular Request

After `0.8.0` react-native-fetch-blob automatically decide how to send the body by checking its type and `Content-Type` in the header. The rule is described in the following diagram
After `0.8.0` react-native-fetch-blob automatically decides how to send the body by checking its type and `Content-Type` in the header. The rule is described in the following diagram

<img src="img/RNFB-flow (1).png" style="width : 90%" />

Expand Down
2 changes: 1 addition & 1 deletion ios/RNFetchBlobReqBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ +(void) buildOctetRequest:(NSDictionary *)options
NSMutableData * blobData;
long size = -1;
// if method is POST or PUT, convert data string format
if([[method lowercaseString] isEqualToString:@"post"] || [[method lowercaseString] isEqualToString:@"put"]) {
if([[method lowercaseString] isEqualToString:@"post"] || [[method lowercaseString] isEqualToString:@"put"] || [[method lowercaseString] isEqualToString:@"patch"]) {
// generate octet-stream body
if(body != nil) {
__block NSString * cType = [[self class] getHeaderIgnoreCases:@"content-type" fromHeaders:mheaders];
Expand Down