【发布时间】:2014-07-18 21:56:47
【问题描述】:
所有, 我对测试 REST 服务发出的每个 HTTP 请求都使用设置为 GET 的方法发送。 Tomcat 使用 405 - Unsupported Method 拒绝。不管我把它改成什么(POST、PUT等)Jmeter总是发送一个GET。
我通过创建一个带有 HTTP 请求采样器和查看结果树的线程组来设置最简单的测试用例。我将 JSON 正文发送到 REST 服务,它只是将请求与 ID 一起回显。与 Google 的 REST 客户端 UI 完美搭配。
这是查看结果树的结果:
Response code: 405
Response message: Method Not Allowed
Response headers:
HTTP/1.1 405 Method Not Allowed
Server: Apache-Coyote/1.1
Allow: POST
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 1045
Date: Fri, 18 Jul 2014 21:39:27 GMT
这是来自我的 REST 服务的 RequestMapping
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
以下是我的结果中的一些屏幕截图。我想知道为什么树中的 HTTP 请求下面有两个 URI?注意 POST 请求看起来是正确的。
【问题讨论】:
标签: jmeter