【问题标题】:Jmeter showing response code as 300 in responseJmeter 在响应中显示响应代码为 300
【发布时间】:2021-09-30 12:52:45
【问题描述】:

我正在使用一个包含 API 的桌面应用程序。

所以当我尝试使用本地服务器名称为 localhost 的 Jmeter 访问 API 时。我收到如下回复

响应码:300

响应消息:MULTIPLE CHOICES

响应数据: {"succeed": false, "error_message": "没有收到 JSON 数据!"}

即使我尝试使用 Content-Type 作为 application/json 和 multipart/form-data,但没有成功。

注意:当我尝试使用 Postman 访问同一个 API 时,我得到了 200 状态。

【问题讨论】:

    标签: api rest jmeter postman user-agent


    【解决方案1】:

    如果您能够使用 Postman 成功执行请求,您也应该能够使用 JMeter 执行此操作。如果不查看您的 Postman 和 JMeter 配置,我们无法说明问题所在,只需确保一切都相同:

    如果您发送相同的请求 - 您将得到相同的响应。

    请注意,您可以使用 JMeter 记录来自 Postman 的请求

    1. 启动JMeter的HTTP(S) Test Script Recorder
    2. 如果您使用HTTPS protocol - 导入JMeter's certificate into Postman
    3. Configure Postman to use JMeter as the proxy
    4. 在 Postman 中运行您的请求
    5. JMeter 将捕获请求并生成相关的HTTP Request 采样器和HTTP Header Manager

    更多信息:How to Convert Your Postman API Tests to JMeter for Scaling

    【讨论】:

      猜你喜欢
      • 2020-01-15
      • 2017-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-04
      • 1970-01-01
      • 1970-01-01
      • 2014-10-29
      相关资源
      最近更新 更多