Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Conversation

@quangpdt
Copy link

When uploading file with multipart/form-data, there's ability to send the list of value, with same attribute name.

Let's have a look on this payload, assuming we're uploading a document with some additional information, these information will be attached into multipart/form-data. Here's an example of the payload pass from webview to the plugin:

{
    foo: 'First information',
    bar: 'Second information'
}

What if user want to send a list of bar, instead only 1 string value?

{
    foo: 'First information',
    bar: ['Second information', 'Third information']
}

I added the ability to check the type of the value, before adding it to the form data. If it's a string, we'll go ahead as usual. If it's a string array, each item will be added to the form data, with a same name.

See more example of JS implementation at: https://developer.mozilla.org/en-US/docs/Web/API/FormData/append

@quangpdt
Copy link
Author

Hi @thomasvidas , could you please give feedbacks on my PR? It's just a small one and won't take much time to review.

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant