最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

json - JetBrains HTTP Client load data from file - Stack Overflow

programmeradmin1浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论