Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMeter HTTP Request: Always Sending GET Method

Tags:

jmeter

All, Every HTTP Request I make to my test REST Service is sent with the method set to GET. Tomcat rejects with a 405 - Unsupported Method. Doesn't matter what I change it to (POST, PUT, etc) Jmeter always sends a GET.

I set up the simplest possible test case by creating a Threadgroup with an HTTP Request Sampler and a View Results Tree. I send a JSON body to the REST Services which just echos back the request along with an ID. Works great with Google's REST Client UI.

Here is the result from the View Results Tree:

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

Here is the RequestMapping from my REST Service

@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")

Here are some screenshots from my results. I wonder why there are two URI's below the HTTP Request in the tree? Notice the POST request looks correct. GET Request

POST Request

Test PlanHeader Manager

like image 356
Nathan Weddle Avatar asked Mar 20 '23 00:03

Nathan Weddle


2 Answers

Since the right answer is not provided yet: It's the "Follow Redirects" Option that causes this behavoir under certain circumstances. see http://www.sqaforums.com/showflat.php?Cat=0&Number=687068&Main=675937

like image 74
javadeveu Avatar answered Mar 21 '23 14:03

javadeveu


Try to end the 'Path' value of HTTP Request with '/'. It has to remove the GET result in View Results Tree.

like image 34
Vadim Shpakovsky Avatar answered Mar 21 '23 13:03

Vadim Shpakovsky