简体   繁体   中英

JMeter http request DELETE with body

I have proprietary http based API to test from JMeter. Unfortunately some of the endpoints of the API are expecting http DELETE method with a request body (I know its questionable API design to use DELETE with request body , but I have no ability to change that API and need to test it).

How can I test it from JMeter? It seems that standard HttpRequest sampler silently ignores my body payload without any warnings. (When I try it in POSTMAN its sending a request body for DELETE method)

I did find an old JMeter plugin called HTTP Raw Request that somewhat helps but still doesn't auto-calculate "Content-Length:" http header for my body payload...so I have to do it manually for every test case - which is a pain for dynamically generated data payloads.

So my question still remains: How can I test HTTP DELETE with request body from JMeter?

Here is the screenshot: 在此输入图像描述

NOTE1: Starting from jMeter ver. 3.1 (see bugzilla #60358 ) it was fixed for Http GET request to be able to send body in the request...but DELETE was not added.

NOTE2: See bugzilla #61443 for the DELETE request with body.

NOTE3: I'm using client implementation called "Java".

As per reference docs:

There are 2 implementations for http request sampler. The non default one called "Java" has this issue with not passing DELETE request body. Luckily the default implementation called "HttpClient4" that correctly passes request payload for DELETE operation as per JMeter data entry screen. To change implementations for http request sampler you have to go to "advanced" tab of the HTTP Request Sampler and select client implementation "HttpClient4" instead of "Java". Here is the screenshot: 在此输入图像描述

After that when executed it correctly sends request payload for DELETE operation. Here is the screenshot: 在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM