jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Luu <manga...@gmail.com>
Subject Re: JSON encoded URL problem
Date Tue, 05 Mar 2013 22:42:30 GMT
I would think a preprocessor is best to deal with that. You could probably
JSON/URL decode that back into the original string in the preprocessor. It
doesn't have to be in Beanshell/Java, could be in Javascript with one of
the other preprocessors. Whatever is easiest to decode the string. Like in
PHP, there's a json_decode(str) method that will do that for you.

On Tue, Mar 5, 2013 at 10:12 AM, Marcelo Jara <marcelojara@hotmail.com>wrote:

> I am using a Regex Extractor to get a URL for the next step in the test
> plan. The Url will change whether the request was successful or not. Here
> is an example:
>
> {"success":true,"successUrl":"/checkout/thankyou?email=77220130305125322mg07gkqup3%
> 40blah.com\u0026order_number=541682470"}
>
> I am extracting the URL correctly using
> successUrl":"(.*?)"
> However, when I try to use it in the next sampler, I get an error. Example:
>
> https://server.test.com/checkout/thankyou?email=77220130305125322mg07gkqup3%40nook.com\u0026order_number=541682470
> The error is
> java.net.URISyntaxException: Illegal character in query at index 85:
> https://uk.pe.nook.com/checkout/thankyou?email=77220130305125322mg07gkqup3%40nook.com\u0026order_number=541682470
>
> I believe this is due to the JSON response which converted '&' to "\u0026"
> in the URL.
> What's the best way to handle this? Do I need to use a Beanshell
> Preprocessor to substitute "\u0026" back to '&' ?
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message