jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Epp, Jeremiah W (Contractor)" <>
Subject RE: Why are HttpArguments always encoded?
Date Wed, 04 Jan 2017 20:36:35 GMT
> -----Original Message-----
> From: Antony Bowesman []
> Sent: Wednesday, January 04, 2017 1:33 AM
> To:
> Subject: Why are HttpArguments always encoded?
> However, this gets encoded, so I debugged the code and found that ALL
> arguments created via HttpSamplerBase end up calling
> setAlwaysEncoded(true), so the JSON body gets encoded when it's POSTed and
> there's no nice way to prevent this.

That sounded really strange, but sure enough--  every constructor ultimately
lowers to the one at line 131 of!

I'd call it a bug.  Generously, a misfeature.  Evidently, it's even been a
problem in the past, considering this definition at line 620 of

public void addNonEncodedArgument(String name, String value, String metadata)

So in your specific case, I think you can work around it without any extra
code by just calling

sampler.addNonEncodedArgument("", body, "");

> Is this a built in limitation for some reason? It seems a rather clunky
> solution.

You'll find a lot of weird decisions like this as you start digging into the
guts of JMeter.  Honestly?  From what I've seen, it's generally safe to
assume you're hitting some form of legacy cruft that's lain dormant for ages
because (for the most part ) the JMeter internal APIs were never intended
for external consumers like you and I.  I know I would like this to change,
and I think there's even some buy-in from the project leadership, but...
well, that's the future not the present.

Here, I was curious and did some git archaeology:
- The addNonEncodedArgument() method was added in March of 2007 as part of
  XML-RPC support for the HTTP proxy.
- The bit in where it calls setAlwaysEncode(true) in
  the constructor looks like it was first added all way back in commit
  1d3ce4e7 from August of 2002.

(HUGE thank you to the project for preserving the full history in their git
mirror!  Seriously, that's good stuff.)

> I have a major performance test framework I am porting to Jmeter and I am
> implementing it using Java samplers with nested Http samplers, as it's the
> simplest way to get this across in a short period of time.

Sounds interesting.  Will you be able to talk about it publicly?


Confidentiality Notice: This electronic message transmission, including any attachment(s),
may contain confidential, proprietary, or privileged information from Chemical Abstracts Service
("CAS"), a division of the American Chemical Society ("ACS"). If you have received this transmission
in error, be advised that any disclosure, copying, distribution, or use of the contents of
this information is strictly prohibited. Please destroy all copies of the message and contact
the sender immediately by either replying to this message or calling 614-447-3600.

View raw message