I am trying to chain API request on using POSTMAN. I am writing a script in the test section for extracting token from the response body and storing it in an environment variable. This is my code in the test section:
var jsonObject = xml2Json(responseBody); let firstresponse= pm.response.json().results; let token = firstresponse.token; pm.environment.set("token1", token);
However, when i run the request, i am getting multiple errors like
JSONError: Unexpected token '<' at 1:1 <!DOCTYPE html> ^
Unexpected token u
I tried googling it, and many have experience similar problems, but none the solution helped me. Is it a bug in Postman or is their any workaround? Anybody has any solutions. I am using POSTMAN Version 6.2.0-canary01.