Getting 400 bad request when uploading attachment on Jmeter

Viewed 31

I recorded uploading an attachment (pdf file) using blazemeter plugin, then open the jmx file using Jmeter. I modified uploads tab as in the following image and placed pdf file under bin directly. when i run the script i got 400 bad request , could you please advise what might be the issue?

Sample result tab

Request body-1

Request body-2

Request body-3

Request Header

Response body

Response Header

1 Answers

As per 400 Bad Request status code description:

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

So I would recommend using a 3rd-party sniffer tool like Fiddler or Wireshark to capture the requests originating from JMeter and the real browser and compare them.

Requests must be exactly the same (apart from dynamic parameters which need to be correlated), once you amend your JMeter configuration so it will send the same request as the real browser does your file upload will be successful.

We cannot suggest anything meaningful unless we see successful and failing requests dumps fully (URL, headers and body)

Related