Re: Question/Help - PUT http request - Cannot overwrite the content type
Dmitri T <[email protected]> Fri, 7 Feb 2025 16:29:26 +0000
| Newsgroups | gmane.comp.jakarta.jmeter.user |
|---|---|
| Message-ID | <SA3PR05MB103724F953B7BBBFBCCCD8C91C0F12@SA3PR05MB10372.namprd05.prod.outlook.com> |
--_000_SA3PR05MB103724F953B7BBBFBCCCD8C91C0F12SA3PR05MB10372na_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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/componen= t_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 <[email protected]> Sent: Friday, February 7, 2025 12:14 PM To: [email protected] <[email protected]> Subject: Question/Help - PUT http request - Cannot overwrite the content ty= pe 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=3Dboundary-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 --_000_SA3PR05MB103724F953B7BBBFBCCCD8C91C0F12SA3PR05MB10372na_--