Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capability to upload multiple files and array of string parameters in one request #304

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ydhnwb
Copy link

@ydhnwb ydhnwb commented Jun 9, 2022

Summary

Add capability to upload multiple files in one request and array of string in parameters.

Test Plan

Android only, multiple files upload in one shot via Multipart

Send all the files in files param. In this case path, field & type will be ignored. Example:

const options = {
  url: 'https://myservice.com/path/to/post',
  files: [
    {
      path: 'file://path/to/file%20on%20device.png',
      field: 'uploaded_media'
    }
  ],
  method: 'POST'
}

Note that type will always be multipart when files is passed

Android only, multiple parameters in one shot via Multipart

Send parameters as list of string.

const options = {
  url: 'https://myservice.com/path/to/post',
  files: [
    {
      path: 'file://path/to/file%20on%20device.png',
      field: 'uploaded_media'
    }
  ],
  paramaters: {
    urls: ["https://example.com", "http://example.com"]
  }
  method: 'POST'
}

However, if you pass the array with single value array like ["example.com"], it will be count as string in your backend. It is using request.addArrayParameter("key", List) in native code.

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS
Android

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I updated the typed files (TS and Flow)
  • I've added Detox End-to-End Test(s)
  • I've created a snack to demonstrate the changes: LINK HERE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants