Collection runner is not executing the GET request when environment variable is appended in the URL but manually works fine

alleshriniwas
Wed, 26 Dec 2018 10:17:55 +0000
Help Hub

Hi,

There are 2 requests in collection: one is POST(I’m setting the environment variable
‘getResponse’ with the value I received from the response body) and another one is GET.

In GET request where I’m sending the URL by appending the global variable(getResponse) like “http://www.abc.com/{{getResponse}}”, when I execute it manually it gives me a response with 201 accepted status, and output in JSON format like below.

{
“id”: “d9c6”,
“reference”: “abcd”
}

But, when I run this request through collection runner I’m getting an error in parsing, gives me 555 error status code and response body is giving nothing but if I hard code the GET URL and run through collection runner it works fine.

Parsing code to get the ‘reference’ parameter from the response body:

let response1 = pm.response.json();
let reference = response1.reference;

Parsing is working fine if I execute the request manually.

Error getting is:

JSONError | No data, empty input at 1:1 ^

Please help!

Thanks in advance!
Shri

8 posts - 3 participants