1

I am using karate framework, I am getting api response in html format and i am having trouble in verification

the response:-

<html>
<head><title>400 Request Header Or Cookie Too Large</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>Request Header Or Cookie Too Large</center>
</body>
</html>

how do i extract:-

"400 Request Header Or Cookie Too Large" from title "Request Header Or Cookie Too Large" from center ------------x--------------x---------------x--------------

My Code:

Given: xxx
Whwn: xxx
Then status 400
* print 'printing response'
* print response
* def text = karate.readAsString(response).  #throws error #(No such file or directory)
* def token = karate.extract(text, ??? , ???)

please help. thanks in advance

1 Answer 1

0

In this case response is already a string so just use it. Refer: https://github.com/karatelabs/karate#responsetype

* def token = karate.extract(response, ??? , ???)

Not the answer you're looking for? Browse other questions tagged or ask your own question.