When you tick "Use multipart/form-data" JMeter will add the relevant header 
during sampler execution.

If you want each part of the multipart message - there is a "Content-Type" 
parameter in the HTTP 
Request<https://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request>
 sampler properties.

It's also possible to build request payload manually like it's described in 
Testing REST API File Uploads in 
JMeter<https://dzone.com/articles/testing-rest-api-file-uploads-in-jmeter>






________________________________
From: Ilie-Iulian Cotiuga <ilie.coti...@gmail.com>
Sent: Friday, February 7, 2025 12:14 PM
To: user@jmeter.apache.org <user@jmeter.apache.org>
Subject: Question/Help - PUT http request - Cannot overwrite the content type

Hello,

I am currently working on a script in JMeter.
The script is a http request of PUT method that updates an xml file and
it's hash, so 1 parameter and 1 file upload
The hash and file path (same dir with the jmx file) are give by a csv so
that i can do in the future multiple xml files.

*Issue*:
When sending the request there is a Header, Content-Type, that is
auto-generated as "multipart/form-data; boundary=boundary-example-test;
charset:UTF-8"
Because of the last part, charset, the endpoint i am hitting returns 403
from the gateway. So I have tried to change that header and send the
request again, but I couldn't... I have tested manually with another
application and the charset is the issue that i am getting 403 on the
request.

All the steps tried:

   1. Http Header Manager -> Doesn't update content-type
   2. Beanshell preprocessor ->  Doesn't update content-type
   3. JSR223 preprocessor ->  Doesn't update content-type

*JMeter version*: 5.6.3

Please keep in mind that on all tries I had checked and also unchecked the
*usemultipart/form-data* checkmark however same results.
As a debugging way I have changed the header name a bit to make sure if the
preprocessors and managers work, and yes. If I put it like "Connet-type",
it will be seen. This leads me to believe that it is overwritten by
something after, and I don't know what.

Is there a way to remove the charset from the auto-generate content type or
to force another content-type for myself  that won't be overwritten?

Regards,
Ilie

Reply via email to