Forum Discussion
Hflower
13 years agoOccasional Contributor
Ideally I'd like to use the method/function that updates the highlighted bit.
I've noticed that the parameters aren't always in the same order when I retrieve them (I think it's because it's a MAP and not an Array?)
This means when I sign the URL before the TestStep is run, I can end up with a different URL sent to the Service, and my authentication fails
//They are QUERY parameters
def queryString = "?"
restTestRequest.params.eachWithIndex{ param, i ->
if((queryString.length() != 1) && (param.value.value != '') )
queryString += "&${param.value.name}=${param.value.value}"
//testString = "${param.value.value}"
else if (param.value.value != ''){
queryString += "${param.value.name}=${param.value.value}"
}
}
path += queryString
After the above code I get:
Path is now /data/app/ws/rest/companies/role/search/v1.0?page=1&q=brown&type=DDIR
When the TestStep runs the URL is
/data/app/ws/rest/companies/role/search/v1.0?q=brown&page=1&type=DDIR
the parameters are in a different order so my HmacSHA256 signature ends up being different
I've tried restTestRequest.setPath(path) and ended up with further weirdness I need to clarify
thanks