【问题标题】:How to send PUT request with variable path parameter AND request parameter in the same endpoint with JMeter?如何使用 JMeter 在同一端点发送带有可变路径参数和请求参数的 PUT 请求?
【发布时间】:2020-07-28 03:58:21
【问题描述】:

我使用的是 Jmeter 5.3,并且需要在同一端点发送带有 PathVariable AND RequestParam 的 PUT 请求。

例子:

@RequestMapping(value = "/authorize/{iduser}", method = RequestMethod.PUT)
    public ResponseEntity<Void> authorizeUser(
            @PathVariable Integer iduser,
            @RequestParam(value = "idstore") Integer idstore,
            @RequestParam(value = "typerequest") Integer type)
            { ...

我使用 HTTP REQUEST 组件

PUT -> <URL>/authorize/${iduser}

参数:

name      | Value
idstore   | 139
type      | 1

但收到 400 BAD REQUEST

{"timestamp":1595881241767,"status":400,"error":"Bad Request",
"message":"Required Integer parameter 'idstore' is not present","path":"/authorize/175"}

有什么建议吗?

【问题讨论】:

  • 错误说还有idplace
  • 对不起,我粘贴了其他堆栈。错误说关于 idstore。

标签: jmeter performance-testing request-mapping http-request-parameters


【解决方案1】:

将参数作为路径的一部分:

PUT -> <URL>/authorize/${iduser}?idstore=139&typerequest=1

也许您还需要使用 application/json 发送 Content-type 标头

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-29
    • 1970-01-01
    • 1970-01-01
    • 2017-11-18
    相关资源
    最近更新 更多