Intellij idea rest client file uploading path as parameter

Trying to make POST request with file as path and added it as variable


###Import
POST http://localhost:8088/v1/import/example/file
Content-Type: multipart/form-data; boundary=boundary

--boundary
Content-Disposition: form-data; name="file"; filename="Example.json"
Content-Type: multipart/form-data;

<{{fileLocation}}

--boundary
Content-Disposition: form-data; name="environment"

{{env}}
--boundary

###
this is my env.json
{
  "tst": {
    "env": "TST",
    "fileLocation": "C:\Temp\Example.json"
 }
}

And keep getting “The file is empty or not parsable” and in the logs txt file is written like this only < C:\Temp\Example.json

Same path without variable works fine.

Looks like a known bug. The fix is coming in 2023.3.2 update. You can try 2023.2.5 from https://www.jetbrains.com/idea/download/other.html as a workaround.

Leave a Comment