Skip to content

Support for blobs #2

@ma-pe

Description

@ma-pe

Thanks for open sourcing your library! :)

Blob-support for react-native's fetch was introduced in 0.54:

facebook/react-native#11417
facebook/react-native#11573

Blobs doesn't seem to work with your library though:

var blob = new Blob();
pinnedFetch('https://jsonplaceholder.typicode.com/posts/1', {
  method: 'PUT',
  body: blob,
  headers: {
    'Content-Type': 'application/octet-stream',
  },
  sslPinning: {[
    "my.certificate"
  ]},
})
.then(response => response.json())
.then(json => console.warn(json));

Leads to:

Exception '-[__NSDictionaryM dataUsingEncoding:]: unrecognized selector sent to instance 0x1c4239de0' was thrown while invoking fetch on target RNSslPinning with params (
    "https://jsonplaceholder.typicode.com/posts/1",
        {
        body =         {
            "_data" =             {
                blobId = "cc129bc0-f470-405f-80f8-2c115b404e76";
                lastModified = 1535620344891;
                offset = 0;
                size = 0;
                type = "";
            };
        };
        headers =         {
            "Content-Type" = "application/octet-stream";
        };
        method = PUT;
        sslPinning =         {
            certs =             (
                "my.certificate"
            );
        };
    },
    137
)

I need ssl pinning for all my request but haven't found a library featuring blob PUTs.

Any thoughts on how to support this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions