Search code examples
apipostjmeterpostmanhttp-status-code-400

Same HTTPS request works in Postman but gives 400 Bad Request in JMeter


I think I tried all the possible combinations of headers and body for my POST request in JMeter but is giving me 400 Bad Request saying that the languagePairID parameter from the body is invalid even tho it is exactly same as in Postman. My headers: enter image description here

And the request: enter image description here

Meanwhile in Postman in works perfectly fine: enter image description here enter image description here

I tried checking and unchecking the multipart/form-data and browser-compatible headers, but nothing seems to help. I read that using Wireshark might be useful in such cases but I think for this one is not possible as it is HTTPS. I will be very grateful for any advice.


Solution

    1. Uncheck "Use mutipart/form-data"

    2. Remove everything from the "Body Data" tab

    3. Switch to "Parameters" tab and put your parameters there:

      enter image description here

    Going forward be informed that you can easily convert your Postman script into JMeter:

    1. Start JMeter's HTTP(S) Test Script Recorder
    2. Import JMeter's certificate to 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