skip to Main Content

I am trying to create a test plan using jmeter.its for an API Post request, I have a header manager, bodydata, checked for spellings and the syntax seems to be correct. However, Im getting 400 response code with the following error shown in the attached image. Anyone with an idea how I can resolve this? Thank you. the error
Here is the request the request

The user doesn’t have to be logged in, i have added a header manager, I have also noticed there header has a cookie value thats hard coded but it appears to be the same in every request. In the UI the API request returns 200 and thats what im expecting with the Jmeter script.

2

Answers


  1. Chosen as BEST ANSWER

    The issues was being caused by an anti-forgery cookie which was hard coded in the request.I used a regex to extract the value from a previous request and used a variable value from the regex to make sure the same value is being passed on to the request that was failing.


  2. In its current form the question cannot be answered comprehensively.

    HTTP Status Code 400 means that

    The 400 (Bad Request) status code indicates that the server cannot or
    will not process the request due to something that is perceived to be
    a client error (e.g., malformed request syntax, invalid request
    message framing, or deceptive request routing).

    1. Check that your ${site} and ${csVersion} variables have their respective values using Debug Sampler and View Results Tree listener combination
    2. Cross check headers sent by JMeter and by the "UI", the most important is Content-Type
    3. Use a sniffer tool like Wireshark of Fiddler and capture the requests which are being sent by JMeter and the "UI", the requests must be exactly the same apart from dynamic parameters which need to be correlated
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search