Bug 40383 - changing Content-Type for HTTP POST request
Summary: changing Content-Type for HTTP POST request
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.2
Hardware: PC Linux
: P2 enhancement with 2 votes (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
: 40233 (view as bug list)
Depends on:
Reported: 2006-09-01 07:21 UTC by Vladim
Modified: 2007-02-12 16:19 UTC (History)
2 users (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Vladim 2006-09-01 07:21:31 UTC
I have the following problem with JMeter.

I am using GWT (Google Web Toolkit) java framework for building web apps. GWT
encapsulates ajax http calls, sending ajax requests via POST to server.

Server always expects content-type: text/plain; charset=utf-8. That is problem
because JMeter's http sampler changes headers. Even if I have correct setting
for Content-type in the http request sampler node, JMeter changes this and sends
Content-Type: application/x-www-form-urlencoded instead. As I said this is
problem with GWT ajax calls. Is there any way how to make JMeter not to change
this header? I used HTTP Request Manager Config element but with no success.

As a workaround I manually changed the source code, edited
org.apache.jmeter.protocol.http.sampler.PostWriter and commented line, which
changes the header. However, there should be a cleaner way to do it.

Comment 1 Sebb 2007-02-10 04:43:10 UTC
OK - I've changed the code to only set the content-type if not already set.

The HttpClient sampler already behaves like this.
Comment 2 Sebb 2007-02-12 16:19:33 UTC
*** Bug 40233 has been marked as a duplicate of this bug. ***
Comment 3 The ASF infrastructure team 2022-09-24 20:37:37 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1781