Asubbiah
10 years agoContributor
can i pass header value from datasource?
Hi I have a grid data source, where i pass the properties: usertype and user name The usertype should be passed as a header value for my REST service. I tried to write an event code for filteri...
- 10 years ago
Header value is a list type. You are putting a string.
Here is an example code snippet, which adds the headers to the given request based on step name.
Issue #1:
${#userDS#usertype} -- this can't directly be used. Instead use context.expand('${#userDS#usertype}')
Similarly other instances in your script.
Also another improvemement in the code is you can use a list to check instead of repeating the code for three times.
def userTypesLookup = ['X', 'Y', 'Z'] if (userTypesLookup.contains(context.expand('${#userDS#usertype}'))) { //do the stuff }