jreyesr / insomnia-plugin-batch-requests

An Insomnia plugin to repeatedly send a request, each time replacing some data with information from a CSV file, and collecting response data into the CSV file.
https://jreyesr.github.io/posts/insomnia-batch-requests/
MIT License
7 stars 0 forks source link

Add the ability to send files that vary per CSV row #15

Closed jreyesr closed 3 months ago

jreyesr commented 3 months ago

This PR adds the ability to send varying files, by providing the file paths in a column in the CSV file.

For example, consider this normal request, which takes two fields in a multipart/form-data request. One text field takes the title of the new file, while another file field takes the actual file. You can imagine this being Google Drive or Dropbox or other similar system that has an endpoint where files can be submitted:

image

This PR adds a new template tag, in addition to the Batch tag that already exists, that can be configured to read from a column in a CSV that is assumed to contain file paths. Any fields that contain this new tag will be modified so the actual file pointed to by the tag is sent.

image

image

image

Then, the request can be sent using the Batch Requests dialog, as normal. Here, because of the tag's configuration, the file path will be read from the fname column on the CSV:

image

image