简体   繁体   中英

Unable to test an API in JMeter where I need to upload a file

can someone please help me with uploading a file on JMeter I feel its very tricky thing...

let me share the screen shot of what I've done

enter image description here

Its failing with below error: Thread Name:jp@gc - Ultimate Thread Group 2-4 Sample Start:2021-02-04 17:28:44 IST Load time:562 Connect Time:0 Latency:562 Size in bytes:595 Sent bytes:84568 Headers size in bytes:446 Body size in bytes:149 Sample Count:1 Error Count:1 Data type ("text"|"bin"|""):text Response code:500 Response message:

HTTPSampleResult fields: ContentType: application/json DataEncoding: null

Response Body: {"timestamp":"2021-02-04T11:58:45.482+00:00","status":500,"error":"Internal Server Error","message":"","path":"/pps/storage/upload-image"}

Request Body: POST https://pixelperfectdevexternal.useready.com/pps/storage/upload-image

POST data: --axOhwnTOrVj2VWGGuxcaqfjgHwGQKsTFl Content-Disposition: form-data; name="filename" Content-Type: image/jpeg; charset=US-ASCII Content-Transfer-Encoding: 8bit

${filename} --axOhwnTOrVj2VWGGuxcaqfjgHwGQKsTFl Content-Disposition: form-data; name="filename"; filename="Passport size photo.jpeg" Content-Type: image/jpeg Content-Transfer-Encoding: binary

<actual file content, not shown here> --axOhwnTOrVj2VWGGuxcaqfjgHwGQKsTFl--

I'm totally stuck on this from last 3 weeks, I did what was told in tutorials and still its not working, someone please help me out.

We don't know how to fix the issue because we don't know how the request should look like, moreover you don't show us "Parameters" tab of the HTTP Request sampler and HTTP Header Manager configuration.

So if you have another way of successfully calling this API like curl or Postman or other tool - you should be able to record the request using JMeter's HTTP(S) Test Script Recorder , see How to Convert Your Postman API Tests to JMeter for Scaling article for example setup.

If not, you need to check your API endpoint documentation, application logs or ask around for the proper request format, once you know it you should be able to amend the request yourself or provide us more details so we could assist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM