Search code examples
jmeteramazon-cloudfrontload-testing

How to remove request body from subsequent requests in JMeter


I tried to create a test script in JMeter where I log in by using API. I created a test script by BlazeMeter chrome extension.

Some of my API calls fail because I am getting CloudFront error. I found out the issue is that GET requests contain a request body. GET requests cannot contain a request body on CloudFront. When I tried the same get requests in postman without request body, I didn't get any errors. I got the same error in postman if I added a body request. This way I can confirm this is the issue.

I am looking for a way how to remove body request from subsequent GET requests in JMeter to get rid of this error.

This is the original API call (sampler) with POST login api request:

enter image description here

enter image description here

After the POST request there is a redirection to a page that makes other GET api calls to fetch static files such js files, etc. The problem is that these GET requests also contain the same request body as the original POST call.

enter image description here

enter image description here

As you can see I can fetch statis files if I remove body request:

enter image description here

I tried to add preprocessor and postprocessor for original POST request, but I don't know how to access subsequent GET requests. I can access only original POST request:

enter image description here

Is there a filter or a way how to remove body request from GET requests?


Solution

  • I don't think it's possible, at least not with JMeter 5.5

    If you take a look at HTTPSamplerBase source code you will see that the request body is being copied fully from the original HTTP Request sampler:

    this.sampler = (HTTPSamplerBase) base.clone();
    

    So the options are in:

    1. Raise an enhancement requests via JMeter Github Issues
    2. Amend HTTPSamplerBase code to remove the request data from generated AsyncSamples
    3. Handle embedded resources download manually using Parallel Controller