charles remove query param value - url-rewriting

How to remove query param value in charles,but save the query param key?
origin
https://stackoverflow.com/questions/ask?title=charles&key=1
expected
https://stackoverflow.com/questions/ask?title=&key=1
I set it in charles rewrite feature to replace query param value, but it can't working. When leave the replace value blank, it only refer the match origin value.
charles rewrite

Unfortunately for you Charles understands the blank value on the replace section as a no change, so you will have to specify a new value there if you want to get rid of it.
I haven't tested it, but I would suggest you to try using the "&" character, as it is the query param separator your request would end up being something like:
https://stackoverflow.com/questions/ask?title=&&key=1
which essentially is the same as the one you were looking for:
https://stackoverflow.com/questions/ask?title=&key=1
It this does work, please let us know.

Related

How to get the required value from the existing value when there is no suffix?

I'm trying to use regular expression extractor concept in Jmeter. By using regEx concept I'm able to get the required token id's. And for all I'm using regEx as (.*?). So this is working fine when we have constant prefix and suffix text/values.
But in this case, there is no suffix,
Ex: Key is = #bluerelay.com/a43a816dcdd14873bd5757b3a3709d5c,
ClickHereForImageForm
I want to take the key ID into a variable with using RegEx. I have tried to get it with (.*?) but it didn't work, it returns the full value, not the required part. It'd be excellent if you could give any suggestion.
The source value is:
https://navitus-internal-app.bluerelay.com/#/token/systemadministrator#bluerelay.com/a43a816dcdd14873bd5757b3a3709d5c
The expected result is to extract a43a816dcdd14873bd5757b3a3709d5c from the above URL and put it into a variable.
You can use regex to get last text after / sign
(.*)\/(\w+)
See demo

How to get the last word from a URL?

Is there a method to extract just the last word from the URL example below? I would like to be able to use this as a heading on a page, i.e the "Account" page.
I found that by using request.path it will give me the path without the root but I'm not sure how to get just the last path name.
/users/1234/account
Try:
request.path.split('/').last
If you want "Account" (instead of "account"), call the capitalize method on the result.
I am not familiar with Ruby, but you can try this approach.
Try string splitting request.path with '/' as the separator and take the last element from the resulting array
users/1234/account will be split to {'user', '1234', 'account'}
Even though this doesn't answer your question directly, I hope it gives you a start
URLs are a simple string consisting of a scheme showing how to connect to a site, the host where the resource is located, plus a path to that resource. You can use File.basename to get the last part of that path, just like we'd use on a file on our disk:
File.basename('/users/1234/account')
=> "account"
Suppose you have URL like https://www.google.com/user/lastword
If you want to store last word of the URL which is lastword in a variable then use the following and pass url as value to finalVal.
var getLastWordFromUrl = finalVal.split("/").last()

Whitespace replacing plus sign in Jmeter

I have this regular expression:
name=\"javax.faces.FormSignature\" value="(.+?)"
that will extract the value I need to pass to a http request. My problem is, if this value happens to have a + or a = sign on it, Jmeter will replace them with a whitespace. That will fail my request.
Has anyone seen this before? I've tried with xpath extractor and the same thing happens.
If this shappens in next request that uses the RegExp extracted value then uncheck Encode checkbox in Parameters Table.
See Send Parameters With the Request:

How do I concatenate string in Pentaho spoon?

I am a newbie to Pentaho (installed today). I was able to do basic transformation in Spoon. Now I need to do some stuff, which I can't figure out how.
my input looks like
2012-09-17|garima|fbhjgjhgj87687jghgj88jgjj|garima#1347868164626|::ffff:120.56.132.137
3rd field is an ID, for which I need to get some information from a REST API
http://api.app.com/app/api/v1/feature/fbhjgjhgj87687jghgj88jgjj
What do I need to do in Spoon to get this done?
Also, data return will be in json format. how do I parse that?
You should first get your input with a CSV File Input using | as delimiter. Then you can get the 3rd field as a string.
Next you probably need to remove all spaces from this string with a String operations step. Look at the Remove special character column, and select space.
Then you need to concatenate it with your http address http://api.app.com/app/api/v1/feature/. For this you'll use a Calculator step. At this step first create a new temporary field tmpAddr, with operation Define a constant value for ... (or something like this, sorry my spoon is in portuguese). At the Field A column you'll write your http address. It's a good practice, after you make this work, to set your address as a system variable so if it changes you don't need to replace it everywhere on your transformations (look at menu Edit -> System Variables).
Now on the same Calculator step create another field, let's say MyAddress, with operation A+B. Choose for Field A the field tmpAddr you just created, and for Field B the 3rd field from your input.
Now on your stream you should have the full address as a field MyAddress. Connect a REST client step. Mark Accept URL from field and choose field MyAddress as URL Field Name. Set Application Type to JSON. Set Result Fieldname as MyResult.
If you need further JSON parsing you can add a Json input step. Set Source is defined in a field and select field MyResult as Get Source from field.
An alternate approach is to use the "Replace in String" step to append the string.
Set 'use RegEx' to Y
Set 'Search' to (.*)
Set 'Replace with' to http://api.app.com/app/api/v1/feature/$1
Set 'Whole Word' to Y
The parentheses in the regex set up a capture group that you can then insert into your replacement string with the $X syntax

what does the empty regex match in ruby?

following a RoR security tutorial (here), i wrote something along the lines of
##private_re = //
def secure?
action_name =~ ##private_re
end
the idea is that in the base case, this shouldn't match anything, and return nil. problem is that it doesn't. i've worked around for the time being by using a nonsensical string, but i'd like to know the answer.
The empty regular expression successfully matches every string.
Examples of regular expressions that will always fail to match:
/(?=a)b/
/\Zx\A/
/[^\s\S]/
It is meant to not change the behavior of the controller in any way, as // will match every string.
The idea is that ##private is meant to be set in the controller to match things you DO want to be private. Thus, that code is meant to do nothing, but when combined with
##private = /.../ in the controller, gives you a nice privacy mechanism.

Resources