是否有一个头管理器配置来解决使用Json主体的JMeter中的422错误?

问题描述 投票:0回答:1

我的Json body Jmeter HTTP请求中的数据是:

{"someone":[],"customer":[{"firstName":"John","lastName":"Smith","email":"[email protected]","mainClient":true,"document":"1234567","documentType":3,"phone":"+12344567876"}],"hotelId":${hotelId},"hotelRoomTypes":[{"total":1,"hotelRoomTypeId":"${hotelRoomTypes}"}]}

我收到了关于回复的消息:

{"code":422,"message":"api.error.product.Something.available"}
json jmeter http-headers
1个回答
1
投票

您的JSON请求格式无效。检查图像:

enter image description here

我已经尝试了一个示例测试,以检查JSON格式有效时它是否有效。添加了CSV数据集配置元素,虚拟采样器和查看结果树监听器以进行检查。它工作得很好。

在JSON请求中将${hotelId}更改为"${hotelId}",然后重试。

CSV文件包含123456作为hotelId并使用变量调用将其传递给Dummy sampler请求。并在View Results tree听众中找到了预期的结果。

Dummy Sampler

View Results Tree

希望这会奏效。

© www.soinside.com 2019 - 2024. All rights reserved.