PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, July 31, 2022

[FIXED] How to use curl request in JMeter?

 July 31, 2022     curl, file-upload, jmeter, load-testing     No comments   

Issue

I have such curl command:

curl -X POST -T "{sample_data.csv}" -H "Content-Type: text/csv" https://api.mysite.com/v1/jobs/upload.json?key={api_key}

The problem is I don't understand in which component in JMeter I should pass "{sample_data.csv}" file to upload to the endpoint.

Now I have such configuration:

enter image description here

When I run test it shows me:

"error":{"message":"Un-Acceptable format, Content-Type must be one of those listed in \"formats\" but you sent \"multipart/form-data; boundary=E-VEr1-ZesF7xja5HezBWptB6xP_gsGODn\"","formats":["text/csv","text/plain","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/json","application/xml","application/vnd.oasis.opendocument.spreadsheet"]}}

Solution

  1. Change "Protocol" to https
  2. Uncheck "Use multipart/form-data for POST"
  3. In "Send Files With the Request" click "Add" and provide file location
  4. Add HTTP Header Manager to sent "Content-Type" header with the value of "text/csv"


Answered By - Dmitri T
Answer Checked By - Mildred Charles (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing