mmoser18
9 years agoFrequent Contributor
Access to query argument in groovy scripts?
I have written some scripts that mangle certain HTTP headers to inject different HTTP headers depending on the target address. I am able to get hold of HTTP headers like this:
def request = testStep.httpRequest def headers = request.requestHeaders headers['applicationid'] = ['foobar']
Is it also possible to get access to individual query parameters and read and/or modify them? If so, how would that look like?
I fancy there must be something like:
def queryArg = request.??? def filter = queryArgs['filter']
to access e.g. the ...?filter=foobar&... query argument.
What would that ??? in the above code snippet be?
Or would one have to do string manipulations on the request's URL?