0
votes

I'm trying the automate the post request of form type for one of my project and I'm getting 400 bad request error in JMeter whereas when I call the same API with the same parameters from POSTMAN its working fine and giving 200 success response code.

Here is the screenshot of the request being sent through JMeter and in the header manager with content-type multipart/form-data with boundary value. Here is an image of the request sent with multipart/form-data with boundary value apparently it seems the parameters are not sent when I viewed in HTTP form.

Response with multipart/form-data and boundary value headers

but when I see the same request in RAW format here is the result:

Request in RAW format

Then I changed the content type in the headers from multipart/form-data with application/x-www-form-urlencoded; The parameter seems to be sent in the request but still getting 400 bad request error.

Request with application/x-www-form-urlencoded content type in headers manager

Please help me out in sending the form data post request in the right way in JMeter.

1

1 Answers

0
votes

You're showing irrelevant images, you should demonstrate HTTP Request setup in JMeter and request configuration in postman, only this way we can figure out what's wrong with your JMeter setup.

In general given your request "from POSTMAN its working fine" - you can just record it using JMeter's HTTP(S) Test Script Recorder

  1. Prepare JMeter for recording, the fastest way is using Recording Template Feature
  2. Prepare Postman for recording. Configure it to use JMeter's HTTP(S) Test Script Recorder as the proxy
  3. Execute the request in Postman. JMeter will capture the relevant HTTP Request sampler and HTTP Header Manager