0
votes

I'm new in Performance Tests, I started using JMeter and creating my own scripts. I am doing stress performance test on an API, until now POST, GET, PATCH all were working, but I stopped at PUT method. I need to send a file using PUT method, in POSTMAN is working (in body I am using file type with the selected file, in the header multipart/form-data).

I tried to put the file path in "Send files with the request", Parameter Name: file, MIME type: form-data, Content encoding: utf-8.

In the request it doesn't give me the file.

PUT http://10.111.30.12/api/tasks/2

PUT data:

[no cookies]

Request Headers:

Connection: keep-alive

X-AuthToken: MjEzNUZFMEMxMzFEQTVBMUMxQzYxMDU0MjE0OEFFRTJDRjU0ODQ0QkRCNDUyQkQ0QTgxREU0M0Y5MDQwMTk1RDJGMEE2RDNERTIxNjFBRjE3MEQ0QTNFQzM1OTVBRjMyQUI0MkJFN0MwMjYxMkFDRTBFMTQyMzYyNjYwMkREMTU0RkMxQTlBMjJDOUJFQkMwRjEwNDdFOTEwNjgyRDAwMTVBOTlEQ0ExQ0FFQTBGQjA2MEVDRUNFQjgzOEQ1MTA4ODVGOUYxMDhBQUM0RTc5N0JDQTA2RkYyNjYxQURGODE3NUM0MDlFN0RENEM0MTc0Nzc4MzczRjNDQ0VDQzM3Q0Y2QzU4REE2ODg2QzAyNEE1MzY0QThDN0IwMjhEMjdE

Content-Type: multipart/form-data

Content-Length: 0

Host: 10.111.30.12

Proxy-Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.2.6 (java 1.5)"

The sampler result:

Thread Name: API Thread Group 1-1

Sample Start: 2015-09-21 15:33:53 EEST

Load time: 22

Connect Time: 0

Latency: 22

Size in bytes: 202

Headers size in bytes: 202

Body size in bytes: 0

Sample Count: 1

Error Count: 1

Response code: 415

Response message: Unsupported Media Type

Also tried to put the file in body data as: "file: C:\apache-jmeter-2.13\bin\API Performance Test\file.txt" but now I am getting 400 bad request.

Please if anyone got any idea on how to do this, tell me too.

1

1 Answers

1
votes

Since you're testing an API my expectation is that you need to add a HTTP Header Manager to send Content-Type header with the value of application/json.

The best way to get to the bottom of the issue is using a sniffer tool like Wireshark to compare what's being sent by Postman and JMeter and make sure that there are no differences.