Search code examples
restjmeterpostmanuser-agent

Jmeter showing response code as 300 in response


I am working in a desktop application which contains API as well.

So when I try to hit the API using Jmeter with the local server name as localhost. I am getting the response as below

Response code:300

Response message:MULTIPLE CHOICES

Response data:

{"succeed": false, "error_message": "No data JSON received!"}

Even I tried with the Content-Type as application/json and multipart/form-data, but not worked.

Note: When I try to hit the same API using Postman, I got the 200 status.


Solution

  • If you're able to successfully execute the request using Postman you should be able to do this using JMeter as well. We cannot state what's wrong without seeing your Postman and JMeter configurations, just make sure that everything is the same:

    If you will send the same request - you will get the same response.

    Be aware that you can just record the request from Postman using JMeter

    1. Start JMeter's HTTP(S) Test Script Recorder
    2. If you're using HTTPS protocol - import JMeter's certificate into Postman
    3. Configure Postman to use JMeter as the proxy
    4. Run your request in Postman
    5. JMeter will capture the request and generate relevant HTTP Request sampler and HTTP Header Manager

    More information: How to Convert Your Postman API Tests to JMeter for Scaling