Jyoti Prakash Mallick
Jyoti Prakash Mallick

Reputation: 2076

Sending parameter with POST requests with Web-kit Form-Data with J Meter

Trying to post a data within WebKitFormBoundary in JMeter 5.2, but getting code:406 message:Not Acceptable.

My parsed data is:

------WebKitFormBoundarycBh5zHV8PGTFb5LA
Content-Disposition: form-data; name="heading"; filename="blob"
Content-Type: application/json

{"headers":[{"name":"Host","value":"https://localhost:443/Country"},
{"name":"Ocp-Apim-Subscription-Key","value":"8dc88db306d04e6d69c553499b74c5sw","secret":true}],
"httpMethod":"GET","host":"https://localhost:443/Country",
"path":"Countries/api/Countries?versionQuery=Countries_V1","scheme":"https"}
------WebKitFormBoundarycBh5zHV8PGTFb5LA--

I am trying post the above data from Jmeter http request in two ways: Method 1:

enter image description here

Method 2: enter image description here

Snap of the browser details: Request Header: enter image description here Form Data: enter image description here

I have handled the X-Request-Verification-Token and RequestVerificationToken, which is working fine. But I am getting

Response message:
Embedded resource download error:https://https://localhost:443/
code:406 message:Not Acceptable

Upvotes: 0

Views: 277

Answers (1)

Dmitri T
Dmitri T

Reputation: 168217

The easiest way of building file upload events in JMeter is simply recording them using JMeter's HTTP(S) Test Script Recorder, just make sure to copy the file you're uploading to the "bin" folder of your JMeter installation, this way JMeter will be able to intercept the request and properly build the HTTP Request sampler.

Check out Recording File Uploads with JMeter for more details if needed.


If you're still looking for a manual way of implementing your request the easiest option would be storing your JSON payload into blob file in the "bin" folder of your JMeter installation and configuring the "File Upload" tab of the HTTP Request sampler to look like:

enter image description here

You should see something like this in the View Results Tree listener:

enter image description here

Upvotes: 0

Related Questions