Hi, I want to check if a specific text appears in a value of the site headers.
I came up with something like this:
WebUI.openBrowser('')
WebUI.navigateToUrl(GlobalVariable.URL)
ArticleUrl = "$GlobalVariable.URL/node/12345"
WebUI.navigateToUrl(ArticleUrl)
response = WS.sendRequestAndVerify(findTestObject('API/Production/Get headers'))
Map<String, List> headerFields = response.getHeaderFields()
println(headerFields)
def thingy = "HIT"
println(headerFields.contains(thingy))
Output of getHeaders looks a bit like this :
[Permissions-Policy:[interest-cohort=()], Server-Timing:[HIT, test;desc="Edge time";dur=1, HIT-CLUSTER, test;desc="Edge time";dur=2]
And I need to check if I there is a βHITβ value in the Server-timing.
With the current code Im getting error
No signature of method: java.util.HashMap.contains() is applicable for argument types: (java.lang.String) values: [HIT]
Possible solutions: containsKey(java.lang.Object), containsKey(java.lang.Object), toString(), toString(), toString(), toString()
Thanks for any tips