3
votes

I'm trying to test a Rest api which is working on postman but not on Jmeter, the request takes (2 parameters):

  • a pdf file
  • a body data (json containing pdf information)

on Postman : when I put the Content-Type = application/x-www-form-urlencoded, and I upload the json file and the pdf file it works but on jmeter I'm always getting errors such as "Unsupported Media Type"

2

2 Answers

0
votes
  1. Please check both the requests(Postman and jmeter) are same with all the values header and content type.
  2. Check “Use multipart/form-data for POST” box is not selected.

Use a multipart/form-data or application/x-www-form-urlencoded post request

Reference;-https://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request

For more information, please check this blog.

Hope this helps.

0
votes

You can try to add record the network request in Jmeter via postman. I have came across the below link which will do the trick for you

https://www.youtube.com/watch?v=OQWyLMJbXaw

The solution mentioned in the above link actually uses a proxy server in Postman and use the same proxy server in Jmeter test script recorder so that whenever a request is being executed in postman, it travels through Jmeter via proxy.