When using the HTTP Client (for .http
files) in JetBrains IDEs is there some way to load data for a JSON property from a file?
Assume the following request:
POST {{Host}}/api/foos
Content-Type: application/json
{
"bar": "baz",
"qux": "<Base64Data>"
}
The encoded data is quite large in this case (about 500KB) so i don't want to copy it into the request file.
I know that a whole JSON request body can be loaded with the < ./file.json
syntax, but because I need the same data in different requests I don't want to do that either.
Another option would be to put it into an .env
file, but I haven't found a nice way to share those between projects (I am working on a demo showing different APIs processing the same data).
Using a multipart/form is also not an option, because I really need it to be a JSON request in this scenario.
What I'd like to do, is load an arbitrary string from a plain text file and have it injected into my JSON request as if stored in a variable => is that possible somehow?
Or is there some way I haven't figured out to use a shared .env
file without having to create a custom run config for each request?