Intellij Idea HTTP 请求负载变量
问题 Intellij Ideas HTTP-Request Post具有有效载荷值取决于环境。例如,在有效载荷中使用时,变量无法代替路径变量。
JSON解码错误:未识别的令牌'test':正在期待(JSON字符串,数字,数组,对象或doken'null','true'或'false');嵌套异常是com.fasterxml.jackson.core.jsonparseexception:未识别的令牌'test':正在期望(json字符串,数字,数字,数组,对象或doken'null',true'or'或false'或false''或false') (io.netty.buffer.bytebufinputstream)
research https://www.jetbrains.com/help/idea/http-client-reference.html
http-client.env.json
{
"LOCAL": {
"protocol": "http://",
"host": "localhost",
"port": ":8000",
"apiKey": "api-key",
"username": "[email protected]",
"password": "password"
}
}
- Intellij 2021.2.1
- 您可以从上下文菜单中选择有效负载变量,并使用CTRL +单击
问题有没有办法在有效载荷中使用变量?
PROBLEM Intellij Idea HTTP-request POST has payload values dependent on an environment. Variables are not substituted when used in a payload as they are in place of path variables, for example.
JSON decoding error: Unrecognized token 'test': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'test': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n at [Source: (io.netty.buffer.ByteBufInputStream)
RESEARCH https://www.jetbrains.com/help/idea/http-client-reference.html
http-client.env.json
{
"LOCAL": {
"protocol": "http://",
"host": "localhost",
"port": ":8000",
"apiKey": "api-key",
"username": "[email protected]",
"password": "password"
}
}
- Intellij 2021.2.1
- you can select payload variables from context menu and navigate with Ctrl + click
QUESTION Is there a way to use variables in a payload?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
玩了一段时间并重新阅读异常后,我猜测将其用双引号引起来。现在它可以工作了:
After playing some time and rereading the exception, I've had a guess to wrap it into double quotes. Now it works: