feat: Multipart Form Data file uploads (#1130)

* Add multipart form files upload support
* clean up
* Fixed electron files browser for Multipart Form files
* Using relative paths for files inside the collection's folder
---------
Co-authored-by: Mateo Gallardo <mateogallardo@gmail.com>
This commit is contained in:
Max Destors
2024-02-04 18:34:18 +01:00
committed by GitHub
parent a97adbb97e
commit 634f9ca4a2
13 changed files with 220 additions and 45 deletions

View File

@@ -109,6 +109,7 @@ const prepareRequest = (request, collectionRoot) => {
each(enabledParams, (p) => (params[p.name] = p.value));
axiosRequest.headers['content-type'] = 'multipart/form-data';
axiosRequest.data = params;
// TODO is it needed here as well ?
}
if (request.body.mode === 'graphql') {

View File

@@ -40,6 +40,7 @@ const runSingleRequest = async function (
// make axios work in node using form data
// reference: https://github.com/axios/axios/issues/1006#issuecomment-320165427
if (request.headers && request.headers['content-type'] === 'multipart/form-data') {
// TODO remove ?
const form = new FormData();
forOwn(request.data, (value, key) => {
form.append(key, value);